Introduction

GNU/Linux Debian Lenny security support has been dropped since a few days (since the 6th of February to be exact). All administrators are encouraged to upgrade their system from Lenny (5.0) to Squeeze (6.0) as soon as possible.

In my previous article I explained how I migrated my dom0 to Squeeze, so now it’s time for me to explain how I did the same thing for domUs.

The domU migration from Lenny to Squeeze

As stated in my previous article, there is nothing specific to be done to migrate from Lenny to Squeeze. Just follow the instructions and everything should go just fine.

DO NOT REBOOT YOUR DOMU YET!

Two things may cause problems during upgrading:

  • PyGrub, the script used by Xen to read the domU boot-loader’s configuration is not compatible with chain-loaded GRUB2. It will just fail finding any boot-loader in this configuration. Please read the following paragraph for the fix.
  • The switch to the device UUID naming schema: it is not possible for the uuid command line tool to generate UUID for xvd (virtualized hard drives) devices. You’ll probably get an error screen stating that it was not possible to switch to the new naming schema. You can safely ignore this warning, as all configuration files will be left untouched.

Cleaning up for GRUB2

Hopefully you didn’t reboot your domUs yet: if you did, they simply won’t start. PyGrub won’t be able to read GRUB’s configuration and will thus refuse to boot anything.

You first need to migrate completely to GRUB2,  then delete GRUB 0.97 configuration files to force PyGrub to read the new ones:

$ sudo upgrade-from-grub-legacy
$ sudo rm /boot/grub/menu.lst*

With this done, you should be able to reboot your domUs without further issue.

Accessing LVM domU disks from the host

In case you didn’t know about the GRUB2 problem (like me) and attempted to reboot one of the domU, I’m gonna explain how to access the LVM-backup domU disks from the host.

You can just use mount because the LVM volume is hosting a disk image, not a partition. While some people are using mount only after computing the starting offset of the partition, I’d rather go with a cleaner, less dangerous solution.

First, you need to install the kpartx utility that we will use to create partition mappings on disk devices:

$ sudo apt-get install kpartx

Now what we’ll do is:

  1. Create a mapping from the LVM volume to the device mapper. This will expose the partitions on the stored disk image.
  2. Mount the device mapper /boot partition mapping to /mnt/
  3. Remove the GRUB 0.97 files
  4. Unmount everything.
I’ll just give one example here. Let’s say you have an LVM volume group called « tank » filed with all your domU’s disk images.
$ sudo kpartx -av /dev/tank/disk-image
$ sudo mount /dev/mapper/disk-image1 /mnt
$ sudo rm /mnt/grub/menu.lst*
$ sudo umount /mnt
$ sudo kpartx -d /dev/mapper/disk-image1

Of course, you will need to adjust the paths for those commands depending on your specific setup.

Conclusion

Migrating a Lenny domU to Squeeze isn’t that straightforward because of this GRUB2 bug. I wonder how it went into the Debian’s stable repository. Probably a Xen upstream bug.

I didn’t notice any regression after upgrading to Xen 4.0. In fact, my domUs seems to be running a little faster, and they also seem more stable.

Trackback

no comment untill now

Add your comment now

CommentLuv badge