Running Xen with LILO

From lxadm | Linux administration tips, tutorials, HOWTOs and articles
Jump to: navigation, search

Normally, Xen will not work with LILO, as LILO can't use multiple initrd images, which Xen needs.

A workaround is to use mbootpack utility: "It takes a multiboot kernel and modules (e.g. a Xen VMM, linux kernel and initrd), and packages them up as a single file that looks like a bzImage linux kernel".

Below - instruction for Xen 3.1, compiled from sources; if you have other kernel version, just change the text appropriately before pasting it.


  • First, uncompress your /boot/xen-3.1.gz image file:
cd /boot
gzip -d -c xen-3.3.0.gz > xen-3.3.0


  • You also have to uncompress your Xen dom0 kernel:
zcat vmlinuz-2.6.18.8-xen > vmlinuz-2.6.18.8-xen-uncomp


  • If you don't have the initrd file yet, create it now:
mkinitrd -v /boot/initrd-2.6.18.8-xen.img 2.6.18.8-xen


  • After downloading and compiling mbootpack, make a single kernel image out of your existing kernel/initrd/Xen:
cd /boot
mbootpack -o vmlinuz-2.6.18.8-xen-mbootpack -m vmlinuz-2.6.18.8-xen-uncomp -m initrd-2.6.18.8-xen.img xen-3.3.0 

Where -o parameter specifies your new, "integrated" dom0 kernel, -m specify your dom0 kernel and initrd, and xen-3.3.0 is an uncompressed Xen image (which we did a while before).


  • The last step is to add an entry in /etc/lilo.conf:
image=/boot/vmlinuz-2.6.18.8-xen-mbootpack
       label="xen"
       root=/dev/syn4/1
       append="dom0_mem=256M -- netloop.nloopbacks=16"
                              # dom0 shouldn't do anything else but serving Xen guests
                              # so usually 128M (or 256M if needed) is mostly OK.
                              # Everything before "--" is passed to Xen;
                              # everything after "--" is passed to the Linux kernel.


Followed by the lilo command to update the changes:

lilo


One could ask why bother with LILO, if everything above can be done with Grub? Setting up Grub can be really painful, if one has the root filesystem (/), including /boot, on top of LVM2, on top of RAID-1. Actually, as of 06 October 2006, it's even not possible - see http://lists.gnu.org/archive/html/bug-grub/2006-10/msg00012.html for more info. LVM support is planned for the upcoming Grub2, still alpha.

If it's the case for you, don't forget to edit /etc/lilo.conf and run lilo twice, to have it installed an all your RAID-1 disks - i.e., change all boot=/dev/sda to boot=/dev/sdb (why not add raid-extra-boot=mbr-only, which solved this problem for me).

This will make sure that your system will boot even if any of the disks failed - well, at least one has to still work, right? :)

Also, using this method is needed if you want to have a diskless Xen server - see https://lxadm.com/Diskless_/_remote_boot_with_Open-iSCSI#Configuring_tftp_server.

Note: in my case (mdadm RAID1) i had to use the following settings: append = "dom0_mem=512M noreboot -- netloop.nloopback=16 root=/dev/md1 ro"


Keywords: Xen, LILO, Grub, RAID, LVM