Ubuntu upgrade to 9.10/10.04 for Xen DomU

I spend recently some time trying to upgrade ubuntu in DomU on the Debian Dom0.

There are two things that need to be taken under consideration:

  1. in most cases Debian does not have kernel new enough to boot newer versions of ubuntu
  2. ubuntu linux-image-xen does not exist anymore.

Before you start  make sure you have update-grub.

You can now run do-release-upgrade which should complete without any problems.

After that do apt-get install linux-image-ec2 (this is the only one working as a DomU)

Now you have to edit /boot/grub/menu.lst and repleace  # indomU=detect with # indomU=false you can do that by using the following command : sed -ie ‘s/^# indomU=detect/# indomU=false/’ /boot/grub/menu.lst because from some reason if you have only -ec2 kernel installed it is not chosen as a domU kernel and not added to the boot menu.

At this stage you can run update-grub and shutdown your VM.

Now we can use pygrub in xen configuration file like this: (only the bit that is in bold needs to be changed in your xen config file)

disk = [

“phy:/dev/xm/sda1,xvda1,w”,
“phy:/dev/xm/swap,xvda2,w”,
]
bootloader=”/usr/lib/xen-3.2-1/bin/pygrub”
# this should be left in case something does not work
#kernel = “/boot/vmlinuz-2.6.26-1-xen-686”
#ramdisk = “/boot/initrd.img-2.6.26-1-xen-686”
memory = 320
name = “domU”
vif = [ “bridge=xen” ]
root = “/dev/xvda1”
extra = “nofb vga=normal xencons=tty”

Please note that order of the harddrives is important to pygrub and you might need to swap them to get it working.

Now is time to check if it worked do xm create -c domU and you should get a grub menu with your ec-2 kernel.

Hope that would help someone.

If something does not work at this stage you can use

/usr/lib/xen-3.2-1/bin/pygrub /dev/xm/sda1

which should display menu of available kernels without need to create vm.

also mounting the drive and chrooting to it might be neccesery to install additional packages (linux-kernel) or doing update-grub if you missed the step earlier

mount /dev/xm/sda1 /mnt

chroot /mnt

apt-get install linux-image-ec2

update-grub

ctrl+d

umount /mnt