Difference between revisions of "Finnix on PV-GRUB"

Finnix, the LiveCD for system administrators
Jump to navigation Jump to search
Line 35: Line 35:
 
Disable all "Filesystem/Boot Helpers" on the profile.
 
Disable all "Filesystem/Boot Helpers" on the profile.
  
To facilitate writing the ISO, create an additional Finnix profile with the Linode system-wide Finnix installation (I called this "Finnix Linode"):
+
Every time you want to re-write a Finnix ISO to the disk, you must use another operating system to do it, since if you were to do it inside the PV-GRUB-booted Finnix, xvdb would be in use.  The easiest way to accomplish this is by using Linode's "Rescue Mode", which uses a system-wide copy of Finnix (sometimes a few versions behind, but that's fine).  Go to the rescue tab and arrange the disks:
  
* Kernel: "Recovery - Finnix (kernel)" (Linode system-wide)
 
* Initrd: "Recovery - Finnix (initrd)" (Linode system-wide)
 
 
* /dev/xvda: PV-GRUB stub boot disk (ext3, can be as small as 32MB)
 
* /dev/xvda: PV-GRUB stub boot disk (ext3, can be as small as 32MB)
* /dev/xvdb: Finnix ISO to write (raw, at least the size of the Finnix ISO, 256MB should be fine)
+
* /dev/xvdb: Disk to write the ISO to (raw, at least the size of the Finnix ISO, 256MB should be fine)
* /dev/xvdh: "Recovery - Finnix (iso)" (Linode system-wide)
+
* /dev/xvdh: "Finnix Media"
* Root device: /dev/xvdh
 
* All "Filesystem/Boot Helpers" disabled
 
  
Use this profile to write the PV-GRUB Finnix ISO to xvdb.  This must be done even after you have a working PV-GRUB Finnix profile, since the disk will be in active use.
+
When copying multiple times, I boot into "Rescue Mode" using this method, mount /media/xvda, and use the following helper script at /media/xvda/run.sh to set a password, start sshd, wait for the copy, and write the ISO:
 
 
When copying multiple times, I boot into the "Finnix Linode" profile, mount /media/xvda, and use the following helper script at /media/xvda/run.sh to set a password, start sshd, wait for the copy, and write the ISO:
 
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh

Revision as of 08:28, 12 November 2012

Arbitrary Finnix builds can be booted in Xen via PV-GRUB. For example, this method is used to test Finnix on Linode before release.

Setup

Create a guest with two disk images:

  • xvda - Stub boot disk for PV-GRUB, ext2 (or ext3; optional).
  • xvdb - The Finnix ISO itself.

Create the filesystem on xvda, and write the Finnix ISO to xvdb:

# mkfs.ext2 /dev/xvda
# dd if=finnix.iso of=/dev/xvdb

Mount xvda and create /boot/grub/menu.lst on it with the following contents:

default 0
timeout 15

title           Finnix
kernel          (hd1)/boot/x86/linux64 quiet
initrd          (hd1)/boot/x86/initrd.xz

That's it, just boot! PV-GRUB will find /boot/grub/menu.list on the first available disk and load it. "(hd1)" will map to the second, the Finnix ISO9660 filesystem with the kernel and initrd.

Remember, paravirt functionality is only available in the 64-bit Finnix kernel, so be sure to use a 64-bit PV-GRUB.

Linode-specific notes

Use the pv-grub-x86_64 Linode kernel.

Disable Lassie to prevent rebooting the system after you have powered it down.

Disable all "Filesystem/Boot Helpers" on the profile.

Every time you want to re-write a Finnix ISO to the disk, you must use another operating system to do it, since if you were to do it inside the PV-GRUB-booted Finnix, xvdb would be in use. The easiest way to accomplish this is by using Linode's "Rescue Mode", which uses a system-wide copy of Finnix (sometimes a few versions behind, but that's fine). Go to the rescue tab and arrange the disks:

  • /dev/xvda: PV-GRUB stub boot disk (ext3, can be as small as 32MB)
  • /dev/xvdb: Disk to write the ISO to (raw, at least the size of the Finnix ISO, 256MB should be fine)
  • /dev/xvdh: "Finnix Media"

When copying multiple times, I boot into "Rescue Mode" using this method, mount /media/xvda, and use the following helper script at /media/xvda/run.sh to set a password, start sshd, wait for the copy, and write the ISO:

#!/bin/sh

set -e

IP="<Linode IP here>"
ISO="$1"

if ! [ -f /media/xvda/run.sh ]; then
  echo "Please mount this under /media/xvda"
  exit 1
fi

if [ -z "$ISO" ]; then
  echo "Usage: $0 finnix.iso"
  exit 1
fi

passwd root
/etc/init.d/ssh start
echo
echo "rsync -avzP -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' $ISO root@$IP:/media/xvda/"
echo
echo "Press enter when done"
read readwait

dd if=/media/xvda/$ISO of=/dev/xvdb
sync; sync