FS#18734 - [grub2] grub-probe fails to detect LVM device for /boot/grub
Attached to Project:
Arch Linux
Opened by Mikhail Vorozhtsov (mvorozhtsov) - Thursday, 18 March 2010, 07:54 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 12 July 2010, 18:45 GMT
Opened by Mikhail Vorozhtsov (mvorozhtsov) - Thursday, 18 March 2010, 07:54 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 12 July 2010, 18:45 GMT
|
Details
Description:
I'm using grub-1.98-4, kernel26-2.6.33.1-1 and udev-151-3. grub-install fails due to grub-probe error: # grub-probe -t device /boot/grub grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?). # mount | grep boot /dev/mapper/WS-boot on /boot type ext3 (rw) The problem is that LVM devices in my /dev/mapper are just symlinks to /dev/dm-N (this is not the case for at least 2.6.30 from 2009.08 livecd, which I successfully used for chroot+grub-install) # ls -l /dev/mapper/WS-boot lrwxrwxrwx 1 root root 7 Mar 18 12:40 /dev/mapper/WS-boot -> ../dm-4 and grub-probe ignores both symlinks and dm-N (see util/getroot.c:find_root_device) Attached patch fixes the problem by treating symlinks in /dev/mapper as regular device nodes. |
This task depends upon
Closed by Tobias Powalowski (tpowa)
Monday, 12 July 2010, 18:45 GMT
Reason for closing: Fixed
Additional comments about closing: fixed 1.98-5
Monday, 12 July 2010, 18:45 GMT
Reason for closing: Fixed
Additional comments about closing: fixed 1.98-5
Mikhail, if your grub2 use uuid (which is the default), switch back to the old /dev/sdx, and test again. If you use grub-mkconfig to generate grub.conf, then uncomment #GRUB_DISABLE_LINUX_UUID=true in /etc/default/grub to enable old sdx device naming, and recreate your config again.
Why this suggestion?
Debian (and Ubuntu) have a patch that fixes a problem when using UUID devices and LVM. The patch make some changes to the code in grub.d/10_linux
01_uuids_and_lvm_dont_play_along_nicely.diff
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index c2da413..cbd9d6b 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -36,7 +36,8 @@ case ${GRUB_DEVICE} in
esac
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
- || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
+ || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
+ || [ "`grub-probe -t abstraction --device ${GRUB_DEVICE} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm" ] ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
While I can't test if the patch fixes the issue, at least it patches without problems against the other patches used in this package, as long if its invoked after the archlinux-fixes patch.
menuentry "Arch Linux" {
insmod mdraid
insmod lvm
insmod ext2
set root=(WS-boot)
linux /vmlinuz26 root=/dev/mapper/WS-root ro quiet
initrd /kernel26.img
}
The actual command I use to install is 'grub-install /dev/sda' (/dev/sda is part of /dev/md0 which is the physical volume of my LVM configuration).
The segfault was in a grub_util_get_dev_abstraction routine's strncpy call. But the patch allowed a device to be found, thus this segfault bug was averted. (grub2 upstream bug?).
The problem was related to the introduction of symlinks in /dev/mapper to point to /dev/dm-0 devices, which changed over time by the kernel/udev folks. It seems at this point in time, the grub2 folks might have not fully dealt with this yet. There is a lot of logic to ignore certain files (symlinks, etc) and intelligently find a root device. Grub2 ignores the symlink, thus the lvm-detection patch, to discern /dev/mapper links and not ignore them. [kind of confused as to the intent for this inthe grub logic]
TODO: I need to see if installing to /dev/dm-0 is broken with this though, as someone on the #grub channel said would be the case.
/ and /boot are both logical volumes on my system. Previous to installing the above patch, Ie had to boot to 2009.08 in order to run grub-mkconfig, else I was plagued with /sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
I ran the patch against grub2-1.98-4 as the last patch applied (after hidden-timeout-fix.patch).
I've never built/used grub-efi, I guess you just need to add --with-platform=efi to the configure flags.
$ makepkg -s -f
# pacman -U <package.file>
Then edit/replace /boot/grub/grub.cfg (installer should generate /boot/grub/grub.cfg.example via grub-mkconfig).
# grub-install <device>
2010-05-28 Colin Watson <cjwatson@ubuntu.com>
Make grub-probe work with symbolic links under /dev/mapper as well
as with real block devices. The Linux world seems to be (at best)
in transition here, and GRUB shouldn't get caught in the middle.
* kern/emu/getroot.c (find_root_device): Follow symbolic links under
/dev/mapper.