Now running Lenny (and a workaround for a Grub bug)

. o O (WordPress 2.7.1 is pretty sexy)

Congratulations on mankind for reaching the splendid milestone that is 1234567890 seconds since 1970 began. Who'd have thought we'd make it this far?

But really, congratulations on the Debian team for releasing Lenny (I even have one package uploaded there)! The point of this post is mainly to point people upgrading their Xen DomUs of a bug that I encountered and how to fix it (thanks to Andy Smith).

When doing the upgrade I got this message:

laney@cripps:~$ sudo dpkg --configure -a
Setting up linux-image-2.6.26-1-xen-686 (2.6.26-13) ...
update-initramfs: Generating /boot/initrd.img-2.6.26-1-xen-686
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/sda1.
grub-probe: error: Cannot find a GRUB drive for /dev/sda1. Check your
device.map.

dpkg: error processing linux-image-2.6.26-1-xen-686 (--configure):
subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-2.6-xen-686:
linux-image-2.6-xen-686 depends on linux-image-2.6.26-1-xen-686; however:
Package linux-image-2.6.26-1-xen-686 is not configured yet.
dpkg: error processing linux-image-2.6-xen-686 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-xen-686:
linux-image-xen-686 depends on linux-image-2.6.26-1-xen-686; however:
Package linux-image-2.6.26-1-xen-686 is not configured yet.
dpkg: error processing linux-image-xen-686 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-2.6.26-1-xen-686
linux-image-2.6-xen-686
linux-image-xen-686

This is apparently a bug in grub-probe when dealing with Xen virtual machines. A post by Andy here gives the magic incantation to fix it:

sudo sh -c "echo '(hd0) /dev/sda' > /boot/grub/device.map && cd /dev && mknod sda b 202 0"

(you might need to change sda to xvda depending on what your error says).

A quick dpkg --configure -a later and everything is hunky-dory. Now in a sexy Lenny system in which everything seems to just work, just like the marketing says. Some Apache and MySQL warnings to fix up, but nothing too major. Yet.

(on a side-note – I got MOTU recently. Breakage coming to an Ubuntu near you. Yay!)

Tags: , , , ,

10 Responses to “Now running Lenny (and a workaround for a Grub bug)”

  1. khankuNo Gravatar Says:

    What for do you have grub installed in a xen domU exactly?
    It isn't necessary and only brings trouble, as you show in this post.

  2. IainNo Gravatar Says:

    It's the way the VM came set up. (it's PyGrub actually). I could have removed it but I wanted to be able to easily fall back to etch's kernel if something didn't work.

  3. ressuNo Gravatar Says:

    pygrub helps in a lot of ways, but this bug has bitten me in more than one environment already.

    There is a better solution for this too, check: http://ressukka.net/blog/posts/20090217_Xen_domU_upgrades/

  4. IainNo Gravatar Says:

    Thanks ressu. I'll send it to Andy and see what he thinks

  5. francois Says:

    Well i'm lost here…

    I tried to debootstrap a 32 bits domU into a 64 bits dom0 under lenny.

    debootstrap –arch=i386 –include=libc6-xen,firmware-bnx2,linux-image-2.6.26-1-xen-686,linux-modules-xen-686,linux-image-xen-686,grub –components=main,contrib,non-free lenny /mnt/xen http://ftp2.fr.debian.org/debian

    But i have this problem (as you) :
    dpkg: error processing linux-image-2.6.26-1-xen-686 (–configure):
    subprocess post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of linux-image-xen-686:
    linux-image-xen-686 depends on linux-image-2.6.26-1-xen-686; however:
    Package linux-image-2.6.26-1-xen-686 is not configured yet.
    dpkg: error processing linux-image-xen-686 (–configure):
    dependency problems – leaving unconfigured
    Errors were encountered while processing:
    linux-image-2.6.26-1-xen-686
    linux-image-xen-686

    I update domU.cfg :
    root = '/dev/xvda1 ro'
    disk = [
    'phy:/dev/xen-lvm/386-disk,xvda1,w',
    'phy:/dev/xen-lvm/386-swap,xvda2,w',
    ]
    and domU fstab :
    /dev/xvda1 / ext3 defaults 0 1
    /dev/xvda2 none swap defaults 0 0
    proc /proc proc defaults 0 0

    But dpkg –configure -a and update-grub does not generate any files under /boot/grub !!

    How to fix that ?

  6. IainNo Gravatar Says:

    Hi Francois,

    Sorry, but I think this is a different problem that I don't have any idea how to fix as I have no experience managing a domU :(

    Iain

  7. alexdb Says:

    I solved this issue like this:

    In the DomU just edit:
    /var/lib/dpkg/info/linux-image-2.6.26-2-xen-686.postinst

    and put this line in comment:
    #command -v update-grub > /dev/null && update-grub

    so the postinstall script won't try to update grub too

  8. BryceNo Gravatar Says:

    In a Xen VM you don't need no stinkin' grub. Another way to solve this problem is to remove the local (unused) grub and kernel image. The kernel image that's used comes from Dom0.
    # dpkg -P linux-image-2.6.26-2-amd64 linux-image-2.6-amd64 grub
    The kernel modules, however, should match Dom0's kernel.

  9. JoachimNo Gravatar Says:

    Bryce, if you want to run very different domU installations it's actually very helpful to use pyGrub since that simplifies maintenance a lot for each domU.

    The approach you describe is the para-virt model, but that's not the only way to run Xen.

  10. B1 » Blog Archive » Running a custom or distribution kernel on a VPS Says:

    [...] has a nice tutorial here but I ran into this bug. Where grub throws: grub-probe: error: Cannot find a GRUB drive for /dev/xvda2. This is due to [...]

Leave a Reply