Bug#627587: grub-pc: grub-probe: error: cannot stat `/dev/root'.

Colin Watson cjwatson at debian.org
Mon May 30 23:57:43 UTC 2011


On Tue, May 31, 2011 at 01:37:06AM +0200, Marco d'Itri wrote:
> On May 31, Adrian Bunk <bunk at stusta.de> wrote:
> 
> > squeeze udev && no initrd && latest grub = FAIL
> Yes, but why?

Because GRUB now scans /proc/self/mountinfo to figure out the device
underlying the root filesystem.  This was part of making btrfs work
properly, and we considered it to be better than the previous code
because it didn't require searching /dev for a device node with the
correct major and minor numbers.

If there is a strong reason to avoid the Breaks on udev, it might be
possible to have it fall back to the older method in the case where the
device named in mountinfo doesn't exist.  Something like this:

=== modified file 'grub-core/kern/emu/getroot.c'
--- grub-core/kern/emu/getroot.c	2011-05-21 05:03:55 +0000
+++ grub-core/kern/emu/getroot.c	2011-05-30 23:56:40 +0000
@@ -220,9 +220,17 @@ grub_find_root_device_from_mountinfo (co
   /* Now scan visible mounts for the ones we're interested in.  */
   for (i = entry_len - 1; i >= 0; i--)
     {
+      struct stat st;
+
       if (!*entries[i].device)
 	continue;
 
+      if (stat (entries[i].device, &st) < 0)
+	/* The root filesystem device recorded in mountinfo does not
+	   exist, perhaps due to a udev bug.  Fall back to more primitive
+	   methods.  */
+	break;
+
       ret = strdup (entries[i].device);
       if (relroot)
 	*relroot = strdup (entries[i].enc_root);

-- 
Colin Watson                                       [cjwatson at debian.org]





More information about the Pkg-grub-devel mailing list