Finnix on PV-GRUB

Finnix, the LiveCD for system administrators

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 any filesystem GRUB will recognize).
  • 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
Personal tools