Bug#704964: grub-pc: GRUB-2 does not handle /dev/disk/by-path/*

Kyle Moffett kyle at moffetthome.net
Mon Apr 8 09:24:53 UTC 2013


Package: grub-pc
Version: 1.99-27
Severity: important
Tags: upstream

As far as I can tell, GRUB-2 doesn't support any kind of symlinks to
/dev/sd*, such as /dev/disk/by-path/*

Specifically, consider the following setup:

* GRUB Root:  /boot/pci-0000:07:00.0-sas-0x1221000003000000-lun-0
  (AKA: /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000000000000-lun-0-part1)

* Boot partition:  /boot
  (AKA: /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000000000000-lun-0-part2)

* Symlinks:
    /boot/pci-0000:07:00.0-sas-0x1221000003000000-lun-0/boot => .
    /boot/pci-0000:07:00.0-sas-0x1221000003000000-lun-0/grub => .

* Device mapping ($GRUB_ROOT/device.map):
    (hd0) /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000000000000-lun-0
    (hd1) /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000001000000-lun-0
    (hd2) /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000002000000-lun-0
    (hd3) /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0

* Auto-generated GRUB-2 config file ($GRUB_ROOT/grub.cfg), whose
  actual contents are irrelevant, but which loads GRUB modules from
  the first partition and kernels/initrds from the second partition.

* Valid device symlinks from udev:
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0 => ../../sde
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0-part1 => ../../sde1
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0-part2 => ../../sde2
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0-part3 => ../../sde3
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0-part4 => ../../sde4


Now, with that set up, I run:
  grub-install --no-floppy \
    --root-directory=/boot/pci-0000:07:00.0-sas-0x1221000003000000-lun-0 \
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0

And it dies with an error:
  /usr/sbin/grub-probe: error: cannot find a GRUB drive for
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0.
    Check your device.map.

If I edit the device.map file and replace it with "/dev/sde" (which it
is a symlink to, by the way), then run:
  grub-install --no-floppy \
    --root-directory=/boot/pci-0000:07:00.0-sas-0x1221000003000000-lun-0 \
    /dev/disk/by-path/pci-0000:07:00.0-sas-0x1221000003000000-lun-0
    /dev/sde
 
Then it works flawlessly.  Unfortunately, this is not useful because
those device names change on boot, depending on whether or not I have
USB devices attached to the system.

Even worse, with my configs:
  grub-probe -m /boot/pci-0000\:07\:00.0-sas-0x1221000003000000-lun-0 \
             -t drive '(hd3)'
  Segmentation fault

Cheers,
Kyle Moffett



More information about the Pkg-grub-devel mailing list