This patch fixes grub-probe fails on probing devices under
/dev/disk/by-id and other similar mount-by alias names. The method
used to determine the whole disk is by it's name without numeric
character end, but this may be wrong for the by-(id|uuid|path) names
as they are not necessary ended without numeric character. For
instance, my disk was named
"/dev/disk/by-id/ata-WDC_WD1600BEKT-60V5T1_WD-WXK0A69Y4761".

The fix is use resolved link to kernel device names (like /dev/sda)
instead of these alias names.

Downstream bug:
https://bugzilla.novell.com/show_bug.cgi?id=757746

=== modified file 'util/getroot.c'
--- util/getroot.c	2012-03-31 10:27:10 +0000
+++ util/getroot.c	2012-04-20 11:06:18 +0000
@@ -2093,7 +2093,16 @@
 static int
 device_is_wholedisk (const char *os_dev)
 {
-  int len = strlen (os_dev);
+  int len;
+  char os_dev_realpath[PATH_MAX];
+
+  if (strncmp (os_dev, "/dev/disk/by-id/", 16) == 0 ||
+      strncmp (os_dev, "/dev/disk/by-uuid/", 18) == 0 ||
+      strncmp (os_dev, "/dev/disk/by-path/", 18) == 0)
+    if (realpath (os_dev, os_dev_realpath))
+      os_dev = os_dev_realpath;
+
+  len = strlen (os_dev);
 
   if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9')
     return 1;

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to