When updating my XenServer virtual machines I got a strange error message:

s0102:/# apt-get update
Get:1 http://security.debian.org lenny/updates Release.gpg [835B]
Hit http://ftp.de.debian.org lenny Release.gpg
Get:2 http://security.debian.org lenny/updates Release [40.8kB]
Hit http://ftp.de.debian.org lenny Release
Get:3 http://volatile.debian.org lenny/volatile Release.gpg [189B]
Get:4 http://volatile.debian.org lenny/volatile Release [40.7kB]
Get:5 http://updates.vmd.citrix.com lenny Release.gpg [197B]
Ign http://security.debian.org lenny/updates/main Packages/DiffIndex
Ign http://ftp.de.debian.org lenny/main Packages/DiffIndex
Ign http://security.debian.org lenny/updates/main Sources/DiffIndex
Get:6 http://security.debian.org lenny/updates/main Packages [320kB]
Ign http://ftp.de.debian.org lenny/main Sources/DiffIndex
Get:7 http://updates.vmd.citrix.com lenny Release [1630B]
Hit http://ftp.de.debian.org lenny/main Packages
Hit http://ftp.de.debian.org lenny/main Sources
Ign http://updates.vmd.citrix.com lenny/main Packages/DiffIndex
Get:8 http://security.debian.org lenny/updates/main Sources [81.2kB]
Ign http://volatile.debian.org lenny/volatile/main Packages/DiffIndex
Ign http://volatile.debian.org lenny/volatile/main Sources/DiffIndex
Ign http://updates.vmd.citrix.com lenny/main Sources/DiffIndex
Get:9 http://volatile.debian.org lenny/volatile/main Packages [7541B]
Get:10 http://updates.vmd.citrix.com lenny/main Packages [2151B]
Get:11 http://volatile.debian.org lenny/volatile/main Sources [2237B]
Get:12 http://updates.vmd.citrix.com lenny/main Sources [294B]
Fetched 498kB in 2s (191kB/s)
Reading package lists... Done

s0102:/var/tmp# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-image-2.6-xen
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
s0102:/#

The reason for this Debian error message is that there is some inconsistency in the Debian package build. The package linux-image-2.6-xen depends on another package which is not installed. As this problem exists on all of ym XenServer virtual machines, it is unlikely that this was caused by some mistake on my side, so I think it is a problem of the package on the Citrix package server.

Anyway, it is easy to fix. Just run apt-get dist-upgrade:

s0102:/# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-image-2.6.29-xs5.5.0.17
The following packages will be upgraded:
  linux-image-2.6-xen
1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.5MB of archives.
After this operation, 69.8MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://updates.vmd.citrix.com lenny/main linux-image-2.6.29-xs5.5.0.17 170 [23.5MB]
Get:2 http://updates.vmd.citrix.com lenny/main linux-image-2.6-xen 2.6.29-xs5.5.0.17 [668B]
Fetched 23.5MB in 47s (494kB/s)
Preconfiguring packages ...
Selecting previously deselected package linux-image-2.6.29-xs5.5.0.17.
(Reading database ... 16794 files and directories currently installed.)
Unpacking linux-image-2.6.29-xs5.5.0.17 (from .../linux-image-2.6.29-xs5.5.0.17_170_i386.deb) ...
Done.
Preparing to replace linux-image-2.6-xen 2.6.29-xs5.5.0.14 (using .../linux-image-2.6-xen_2.6.29-xs5.5.0.17_i386.deb) ...
Unpacking replacement linux-image-2.6-xen ...
Setting up linux-image-2.6.29-xs5.5.0.17 (170) ...

 Hmm. There is a symbolic link /lib/modules/2.6.29-xs5.5.0.17/build
 However, I can not read it: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.29-xs5.5.0.17/build


 Hmm. The package shipped with a symbolic link /lib/modules/2.6.29-xs5.5.0.17/source
 However, I can not read the target: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.29-xs5.5.0.17/source

Running depmod.
Finding valid ramdisk creators.
Using mkinitramfs-kpkg to build the ramdisk.
Running postinst hook script update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.29-xs5.5.0.17
Found kernel: /vmlinuz-2.6.29-xs5.5.0.14
Found kernel: /vmlinuz-2.6.26-2-686-bigmem
Updating /boot/grub/menu.lst ... done

Setting up linux-image-2.6-xen (2.6.29-xs5.5.0.17) ...
s0102:/#

The new kernel vmlinuz-2.6.29-xs5.5.0.17 has been installed.

While we are at it, we could as well delete the old kernels as they are no longer in use and recover a few MByte of disk space.

s0102:/# apt-get purge linux-image-2.6-686-bigmem linux-image-2.6.26-2-686-bigmem linux-image-2.6.29-xs5.5.0.14

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-2.6-686-bigmem* linux-image-2.6.26-2-686-bigmem* linux-image-2.6.29-xs5.5.0.14*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 69.5MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 19714 files and directories currently installed.)
Removing linux-image-2.6-686-bigmem ...
Removing linux-image-2.6.26-2-686-bigmem ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.29-xs5.5.0.17
Found kernel: /vmlinuz-2.6.29-xs5.5.0.14
Updating /boot/grub/menu.lst ... done

Purging configuration files for linux-image-2.6.26-2-686-bigmem ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.29-xs5.5.0.17
Found kernel: /vmlinuz-2.6.29-xs5.5.0.14
Updating /boot/grub/menu.lst ... done

Removing linux-image-2.6.29-xs5.5.0.14 ...
Ok, proceeding with removing running kernel image.
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.29-xs5.5.0.17
Updating /boot/grub/menu.lst ... done

The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old
Unless you used the optional flag in lilo,
 you may need to re-run your boot loader[lilo]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old
Unless you used the optional flag in lilo,
 you may need to re-run your boot loader[lilo]
Purging configuration files for linux-image-2.6.29-xs5.5.0.14 ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.29-xs5.5.0.17
Updating /boot/grub/menu.lst ... done

s0102:/#

During delete a warning is displayed informing that we are about to delete a running kernel and whether would like to cancel the operation. In this case, it is ok to answer this with "No".

Before we reboot, we should check the /boot/grub/menu.lst file whether it contains a reference to the new installed kernel. If not, we will not be able to boot.

The last lines of /boot/grub/menu.lst should look like this:

## ## End Default Options ##

title           Debian GNU/Linux, kernel 2.6.29-xs5.5.0.17
root            (hd0,0)
kernel          /vmlinuz-2.6.29-xs5.5.0.17 root=/dev/mapper/dsk-root ro console=hvc0 quiet
initrd          /initrd.img-2.6.29-xs5.5.0.17

title           Debian GNU/Linux, kernel 2.6.29-xs5.5.0.17 (single-user mode)
root            (hd0,0)
kernel          /vmlinuz-2.6.29-xs5.5.0.17 root=/dev/mapper/dsk-root ro console=hvc0 single
initrd          /initrd.img-2.6.29-xs5.5.0.17

### END DEBIAN AUTOMAGIC KERNELS LIST