Tuesday, May 10, 2011

Ubuntu 11.04 on Citrix XenServer 5.5, Part 4

This is part 4 of a series on installing Ubuntu 11.04 (Natty Narwhal) on Citrix XenServer 5.5 in paravirtualization (PV) mode. [Part 1] [Part 2] [Part 3]

Sorry to have kept you waiting a few days because if you've finished your Ubuntu install and rebooted, the following error from pygrub occurred at VM startup:

RuntimeError: Unable to find partition containing kernel

This is due to pygrub in XenServer 5.5 not supporting grub 2, which is used by Ubuntu 11.04. To bypass pygrub trying to determine the boot configuration, the kernel location and arguments need to be supplied. Determine this by editing the bootloader configuration:

# xe-edit-bootloader -n [Disk Label] -p 1 -f /grub/grub.cfg

where [Disk Label] is the disk label, typically the vm name. It also assumes you took my advice in part 3 and made /boot the first and a separate partition, since "-p 1" specifies partition 1, and "-f" specifies the path to the grub.cfg relative to the partition. Otherwise you will need to determine the partition and path to /boot/grub/grub.cfg.

Find the first menuentry which should have entries similar to this:

linux /vmlinuz-2.6.38-8-generic root=UUID=5f05322a-a159-4604-9da9-905b0506d882 ro console=hvc0 quiet vt.handoff=7
initrd /initrd.img-2.6.38-8-generic

To modify boot parameters, obtain and verify the VM's uuid:

# VMUUID=`xe vm-list name-label="[VM name]" params=uuid --minimal`
# echo $VMUUID

All of these commands may not be needed, but it is good practice to verify PV is configured properly. Supply kernel arguments exactly as shown in your grub.cfg menuentry (Note: your root UUID will differ!) and the paths to the kernel/ramdisk files:

# xe vm-param-clear uuid=$VMUUID param-name=HVM-boot-policy
# xe vm-param-set uuid=$VMUUID PV-bootloader=pygrub
# xe vm-param-set uuid=$VMUUID PV-args="root=UUID=5f05322a-a159-4604-9da9-905b0506d882 ro console=hvc0  splash quiet vt.handoff=7"
# xe vm-param-set uuid=$VMUUID PV-bootloader-args="--kernel=/vmlinuz-2.6.38-8-generic --ramdisk=/initrd.img-2.6.38-8-generic"

Obtain and verify the VM's disk VBD uuid:

# VBDUUID=`xe vm-disk-list uuid=$VMUUID | grep -A1 VBD | tail -n 1 | cut -d: -f2 | awk '{print $1}'`
# echo $VBDUUID

Set the VM's disk to be bootable:

# xe vbd-param-set uuid=$VBDUUID bootable=true

Unfortunately, even after all of this the system will fail to boot giving the error:

ALERT! /dev/disk/by-uuid/... does not exist.

and will drop you to a "BusyBox" shell.   The hard disk device driver does not load by default.  Resolve this by loading it manually at the prompt:

(initramfs) modprobe xen-blkfront
(initramfs) exit

Booyah! The system is finally booted!  Another workaround to the boot issues would be to configure the virtual system to boot in HVM mode temporarily:

# xe vm-param-set uuid=$VMUUID HVM-boot-policy=BIOS\ order

You would just need to re-run all the xe commands to reconfigure PV mode after determining the kernel path/arguments, and configuring it to load modules at boot time.

With the system up and running, I'll save cleaning up the boot process for the final part of this series.

1 comments:

  1. It took me quite a while to find this out:
    While you're checking the UUID in grub.cfg, get the build number (?) of the kernel:
    linux /vmlinuz-2.6.38-8-generic root=UUID=5f05322a-a159-4604-9da9-905b0506d882 ro console=hvc0 quiet vt.handoff=7
    initrd /initrd.img-2.6.38-8-generic

    -8 in this case.

    I tried to install and I had to change ..38-8 to ..38-11 in:
    xe vm-param-set uuid=$VMUUID PV-bootloader-args="--kernel=/vmlinuz-2.6.38-8-generic --ramdisk=/initrd.img-2.6.38-8-generic"

    ReplyDelete