tags 496040 patch
thanks

On Fri, Aug 22, 2008 at 07:24:01PM +0930, Arthur Marsh wrote:
> Package: grub-pc
> Version: 1.96+20080724-8
> Severity: minor
> 
> 
> when installing a new kernel I get the following messages:
> 
> Running /usr/sbin/update-grub.
> error: unknown device hd1
> error: unknown device hd1
> Updating /boot/grub/grub.cfg ...
> error: unknown device hd1

Hi,

Your problem is in device.map, but grub should tell you about that instead of
reporting those ugly errors.

Would you please confirm if the attached patch turns these error messages
into beautiful warnings?

Thanks

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
Index: util/biosdisk.c
===================================================================
--- util/biosdisk.c	(revision 1828)
+++ util/biosdisk.c	(working copy)
@@ -136,9 +136,21 @@
   unsigned i;
 
   for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
-    if (map[i].drive && hook (map[i].drive))
-      return 1;
+    if (map[i].drive)
+      {
+	struct stat st;
 
+	if (stat (map[i].device, &st) < 0 || ! S_ISBLK (st.st_mode))
+	  {
+	    fprintf (stderr, "Warning: %s is listed in device.map but its device node (%s) does not exist\n",
+		     map[i].drive, map[i].device);
+	    continue;
+	  }
+
+	if (hook (map[i].drive))
+	  return 1;
+      }
+
   return 0;
 }
 

Reply via email to