Bug#594221: Broken DMRAID support in grub-probe

Modestas Vainius modestas at vainius.eu
Tue Aug 24 16:30:01 UTC 2010


Package: grub-common
Version: 1.98+20100804-2
Severity: important
Tags: patch sid squeeze

Hello,

current versions of grub-probe in squeeze and sid have problems with DMRAID
partitions.  The problems are demonstrated below. As a result, grub
lenny->squeeze upgrade failed leaving my system without a bootloader. While
grub-common/lenny had no support for DMRAID at all, it would be a pity to
release current grub-common with half working DMRAID support. Therefore, it
would be great if the bug was fixed in squeeze. A proposed patch is attached
to this mail. Please forward the bug and/or the patch upstream.

As you see, the root is mounted on the DMRAID partition.
$ mount 

/dev/mapper/pdc_bacfhgjjjc1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/mapper/lvmmain-usr on /usr type ext3 (rw,errors=remount-ro)
/dev/mapper/lvmmain-var on /var type ext3 (rw,errors=remount-ro)
/dev/mapper/lvmmain-home on /home type ext3 (rw,errors=remount-ro)
/dev/mapper/lvmmain-data on /mnt/data type ext3 (rw,user_xattr,errors=remount-ro)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

$ cat /boot/grub/device.map

(fd0)   /dev/fd0
(hd0)   /dev/disk/by-id/ata-WDC_WD800BB-00DKA0_WD-WMAHL3755817
(hd1)   /dev/disk/by-id/ata-WDC_WD800BB-00DKA0_WD-WMAHL3848610
(hd2)   /dev/mapper/pdc_bacfhgjjjc

$ ls -l /dev/mapper
total 0
crw------- 1 root root 10, 59 Rgp 24 13:19 control
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 lvmmain-data -> ../dm-6
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 lvmmain-home -> ../dm-5
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 lvmmain-swap -> ../dm-7
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 lvmmain-usr -> ../dm-4
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 lvmmain-var -> ../dm-3
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 pdc_bacfhgjjjc -> ../dm-0
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 pdc_bacfhgjjjc1 -> ../dm-1
lrwxrwxrwx 1 root root      7 Rgp 24 13:19 pdc_bacfhgjjjc2 -> ../dm-2

The attached patch fixes the following issues. The first two prevent
grub-install from working when / is mounted to a partition on the DMRAID disk.

Before patching (1.98+20100804-4):

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/mapper/pdc_bacfhgjjjc1
grub-probe: error: cannot find a GRUB drive for /dev/mapper/pdc_bacfhgjjjc1.  Check your device.map.

# grub-probe --device-map=/boot/grub/device.map --target=fs /
grub-probe: error: cannot find a GRUB drive for /dev/mapper/pdc_bacfhgjjjc1.  Check your device.map.

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/dm-1
(/dev/dm-1)

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/mapper/pdc_bacfhgjjjc
(hd2)

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/dm-0
(hd2)

After patching:

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/mapper/pdc_bacfhgjjjc1
(hd2,msdos1)

# grub-probe --device-map=/boot/grub/device.map --target=fs /
ext2

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/dm-1
(hd2,msdos1)

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/mapper/pdc_bacfhgjjjc
(hd2)

# grub-probe --device-map=/boot/grub/device.map --target=drive -d /dev/dm-0
(hd2)

The patch also fixes a memory leak which I discovered when fixing the above
(error message originates from libdevmapper):

# grub-probe --device-map=/boot/grub/device.map --target=fs /
ext2
You have a memory leak (not released memory pool):
 [0x88157e0]


-- 
Modestas Vainius <modestas at vainius.eu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_dmraid.patch
Type: text/x-patch
Size: 4830 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100824/e4c43c63/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100824/e4c43c63/attachment.pgp>


More information about the Pkg-grub-devel mailing list