#782998 grub-pc: grub fails to boot when installing Debian/wheezy to a virtio disk with lvm >=v2.02.106

Package:
grub-pc
Source:
grub2
Description:
GRand Unified Bootloader, version 2 (PC/BIOS version)
Submitter:
Michael Prokop
Date:
2015-04-20 10:48:07 UTC
Severity:
normal
#782998#5
Date:
2015-04-20 10:39:08 UTC
From:
To:
Since lvm2 v2.02.106 its udev rule creates a /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for PVs:

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=417e52c13a8156b11c25c411d44bda8b32bf87e4

lvm2 2.02.111-2.2 as present in Debian/jessie includes this change in
/lib/udev/rules.d/69-lvm-metad.rules.

When debootstrapping Debian/wheezy to a virtio disk from a system
running Debian/jessie (or using lvm2 >=v2.02.106) this causes the
resulting GRUB installation to look like that (`/media/ngcp-root` is
the mounted logical volume with the rootfs which also includes /boot):

| root@grml ~ # cat /media/ngcp-root/boot/grub/device.map
| (hd0)   /dev/disk/by-id/lvm-pv-uuid-RNZHr8-hLlc-nles-X9Gs-RYSp-Mqo7-uZTk6N
| (hd1)   /dev/vda

and failing to boot with:
system before installing GRUB it works fine:

| root@grml ~ # rm /dev/disk/by-id/lvm-pv-uuid-RNZHr8-hLlc-nles-X9Gs-RYSp-Mqo7-uZTk6N
| root@grml ~ # ls /dev/disk/by-id
| ata-QEMU_DVD-ROM_QM00003@  dm-name-ngcp-swap@                                                             dm-uuid-LVM-lQhnvLyYmhESObLrZcnJs4FTZq9usVDzRex3ImRtrmqhpDH9xKBj22St82lHDADh@
| dm-name-ngcp-root@         dm-uuid-LVM-lQhnvLyYmhESObLrZcnJs4FTZq9usVDzrcMaDfk8O0RionEYRxdjnYxsY6eb0Esi@
| root@grml ~ # grml-chroot /media/ngcp-root/ grub-install --recheck /dev/vda # `grml-chroot` makes sure /proc, /sysfs and /dev are properly mounted in the chroot
| Writing /etc/debian_chroot ...
| Installation finished. No error reported.
| root@grml ~ # cat /media/ngcp-root/boot/grub/device.map
| (hd0)   /dev/vda

NOTE: This problem seems to exist only for virtio disks. When using a
disk on the SATA bus the resulting device.map of the Debian/wheezy
system looks like that and boots fine:

| root@grml ~ # cat /media/vg0-root/boot/grub/device.map
| (hd0)   /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005
| (hd1)   /dev/disk/by-id/lvm-pv-uuid-lJJr4E-M96R-3eIS-b6YO-5usn-bH5o-osQV2B

regards,
-mika-