Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 321569

Summary: sys-fs/lvm2-2.02.64: fix grub2 support
Product: Gentoo Linux Reporter: Fabio Erculiani (RETIRED) <lxnay>
Component: Current packagesAssignee: Robin Johnson <robbat2>
Status: RESOLVED WONTFIX    
Severity: normal CC: agk, cardoe, chrsclmn
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg682339.html
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: lvm2 udev rules patch
make grub2 follow symbolic links in /dev/mapper/
make grub2 follow symbolic links in /dev/mapper/
make grub2 follow symbolic links in /dev/mapper/ (from upstream)

Description Fabio Erculiani (RETIRED) gentoo-dev 2010-05-26 15:48:23 UTC
On a lvm2 rootfs, grub-probe fails to detect "/", making grub-mkconfig fail.
The problem is caused by some udev rules updates that have been merged into latest lvm2 builds. The attached patch restores the previous /dev/mapper device files and makes grub2 happy. Grub2 is unable to read devices or whatever it does through symlinks. Googling a bit, it looks like upstream (grub) is aware but didn't take any action yet.

Reproducible: Always
Comment 1 Fabio Erculiani (RETIRED) gentoo-dev 2010-05-26 15:49:15 UTC
Created attachment 233015 [details, diff]
lvm2 udev rules patch
Comment 2 Chris Coleman 2010-05-28 01:44:00 UTC
I worked around this bug by modifying grub2 so that it does not ignore the /dev/dm-x devices. Not a perfect solution, but it worked.

I've just reverted that and applied your patch to lvm2. It works, but I now get lots of annoying messages about symlinks at startup and shutdown.

I think I'll leave the symlinks in /dev/mapper/ and patch grub2. It should treat those symlinks as block devices.

Comment 3 Chris Coleman 2010-05-28 03:26:22 UTC
Created attachment 233195 [details, diff]
make grub2 follow symbolic links in /dev/mapper/
Comment 4 Fabio Erculiani (RETIRED) gentoo-dev 2010-05-28 04:58:20 UTC
I'm not getting any symlink message here. Running latest udev and lvm2 from ~. What are these messages?
Comment 5 Chris Coleman 2010-05-28 05:47:45 UTC
(In reply to comment #4)
> I'm not getting any symlink message here. Running latest udev and lvm2 from ~.
> What are these messages?
> 

I didn't log the messages and I have a different setup now, but I grepped the source code with what I remembered of the shutdown messages:

"The link %s should have been removed by udev but it is still present. Falling back to direct link removal."

I had that message for each of my logical volumes. It is the output of lvchange -a n being called by /etc/init.d/lvm.

If you insist, I could recreate the conditions and let you know what the startup messages were.
Comment 6 Fabio Erculiani (RETIRED) gentoo-dev 2010-05-28 05:58:01 UTC
weird, I didn't get those warnings at first. I am for fixing grub2 too (rather than playing with easy-to-break udev rules), would it be possible to have your grub2 patch reviewed upstream prior to adding to our ebuild?
Comment 7 Chris Coleman 2010-05-28 06:09:49 UTC
> "The link %s should have been removed by udev but it is still present. Falling
> back to direct link removal."

Sorry, that actually was not the right message. I reapplied your patch. On startup I get messages like:

udevd-work[288]: kernel provided name 'dm-10' and NAME= 'mapper/vg-foo' disagree, please use SYMLINK+= or change the kernel to provide the proper name

And on shutdown:

Node /dev/mapper/vg-foo was not removed by udev. Falling back to direct node removal.
Comment 8 Chris Coleman 2010-05-28 06:30:55 UTC
(In reply to comment #6)
> weird, I didn't get those warnings at first. I am for fixing grub2 too (rather
> than playing with easy-to-break udev rules), would it be possible to have your
> grub2 patch reviewed upstream prior to adding to our ebuild?
> 

I've attached the patch to the upstream bug: https://savannah.gnu.org/bugs/index.php?29697

Though I'm not sure that this patch offers the best solution.
Comment 9 Chris Coleman 2010-05-28 17:31:14 UTC
Created attachment 233301 [details, diff]
make grub2 follow symbolic links in /dev/mapper/

A minor improvement. Using realpath() was a bit inelegant when I could have simply used stat() instead of lstat().
Comment 10 Chris Coleman 2010-05-28 18:26:27 UTC
Created attachment 233317 [details, diff]
make grub2 follow symbolic links in /dev/mapper/ (from upstream)

This has now been fixed upstream (in bzr). The patch is almost identical to mine.

------------------------------------------------------------
revno: 2403 [merge]
committer: Colin Watson <cjwatson@ubuntu.com>
branch nick: grub
timestamp: Fri 2010-05-28 13:21:30 +0100
message:
  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.
------------------------------------------------------------
Comment 11 Fabio Erculiani (RETIRED) gentoo-dev 2010-05-28 18:36:06 UTC
@robbat2, can I add it as well as other 1.98 patches (available [1]) taken from ubuntu?

[1] http://gitweb.sabayon.org/?p=overlay.git;a=tree;f=sys-boot/grub/files/ubuntu-upstream-1.98;hb=HEAD

Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-05-28 21:20:54 UTC
lxnay:
I only maintain grub1. Ask vapier for grub2, but should be ok.

I'm going to close this since I think fixing Grub is better too, and the udev change has other side-effects.