Bug#479056: grub: destroys /boot/grub/device.map
On Tue, May 06, 2008 at 04:21:57PM +0200, Robert Millan wrote: > On Tue, May 06, 2008 at 03:12:54PM +0200, Aurelien Jarno wrote: > > > > > > Ah, I think I see the problem. Please try this patch. > > > > It does work for /dev/vda, but not for /dev/vda1: > > Looks like I missed a small detail. Here, I merged all the above changes in > a single patch. Does this one work? > Yes, that works, thanks a lot. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [EMAIL PROTECTED] | [EMAIL PROTECTED] `-people.debian.org/~aurel32 | www.aurel32.net -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#479056: grub: destroys /boot/grub/device.map
On Tue, May 06, 2008 at 03:12:54PM +0200, Aurelien Jarno wrote: > > > > Ah, I think I see the problem. Please try this patch. > > It does work for /dev/vda, but not for /dev/vda1: Looks like I missed a small detail. Here, I merged all the above changes in a single patch. Does this one work? -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c --- ../grub2/util/biosdisk.c 2008-04-07 18:45:01.0 +0200 +++ ./util/biosdisk.c 2008-05-06 16:14:32.0 +0200 @@ -227,6 +227,7 @@ linux_find_partition (char *dev, unsigne format = "part%d"; } else if ((strncmp (real_dev + 5, "hd", 2) == 0 + || strncmp (real_dev + 5, "vd", 2) == 0 || strncmp (real_dev + 5, "sd", 2) == 0) && real_dev[7] >= 'a' && real_dev[7] <= 'z') { @@ -645,12 +646,13 @@ get_os_disk (const char *os_dev) return path; } - /* If this is an IDE disk or a SCSI disk. */ + /* If this is an IDE, SCSI or Virtio disk. */ if ((strncmp ("hd", p, 2) == 0 + || strncmp ("vd", p, 2) == 0 || strncmp ("sd", p, 2) == 0) && p[2] >= 'a' && p[2] <= 'z') { - /* /dev/[hs]d[a-z][0-9]* */ + /* /dev/[hsv]d[a-z][0-9]* */ p[3] = '\0'; return path; } diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/grub-mkdevicemap.c ./util/grub-mkdevicemap.c --- ../grub2/util/grub-mkdevicemap.c 2008-05-06 12:10:08.0 +0200 +++ ./util/grub-mkdevicemap.c 2008-05-06 16:18:50.0 +0200 @@ -267,6 +267,12 @@ get_scsi_disk_name (char *name, int unit #ifdef __linux__ static void +get_virtio_disk_name (char *name, int unit) +{ + sprintf (name, "/dev/vd%c", unit + 'a'); +} + +static void get_dac960_disk_name (char *name, int controller, int drive) { sprintf (name, "/dev/rd/c%dd%d", controller, drive); @@ -443,6 +449,22 @@ make_device_map (const char *device_map, } #ifdef __linux__ + /* Virtio disks. */ + for (i = 0; i < 20; i++) +{ + char name[16]; + + get_virtio_disk_name (name, i); + if (check_device (name)) + { + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); + num_hd++; + } +} + /* ATARAID disks. */ for (i = 0; i < 8; i++) {
Bug#479056: grub: destroys /boot/grub/device.map
On Tue, May 06, 2008 at 01:26:03PM +0200, Robert Millan wrote: > On Sat, May 03, 2008 at 05:14:31PM +0200, Aurelien Jarno wrote: > > > > I am sure about that. The only difference is that /usr/sbin/update-grub > > does not uses the same command, but this one instead: > > > > grub-probe --device-map=/boot/grub/device.map -t drive -d /dev/vda1 > > > > And this command: > > 1) fails > > 2) destroys /boot/grub/device.map > > Ah, I think I see the problem. Please try this patch. It does work for /dev/vda, but not for /dev/vda1: # grub-probe --device-map=/boot/grub/device.map -t drive -d /dev/vda -v grub-probe: info: `/dev/fd0' looks like a floppy drive, skipping grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: /dev/vda starts from 0 (hd0) # grub-probe --device-map=/boot/grub/device.map -t drive -d /dev/vda1 -v grub-probe: info: `/dev/fd0' looks like a floppy drive, skipping grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda1' grub-probe: info: opening the device `/dev/vda1' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: Cannot find a GRUB drive for `/dev/vda1', will regenerate device.map and try again grub-probe: info: `/dev/fd0' looks like a floppy drive, skipping grub-probe: error: /boot/grub/device.map:2: Duplicated entry found /boot/grub/device.map is not destroyed anymore and still contains: (fd0) /dev/fd0 (hd0) /dev/vda -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [EMAIL PROTECTED] | [EMAIL PROTECTED] `-people.debian.org/~aurel32 | www.aurel32.net -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#479056: grub: destroys /boot/grub/device.map
On Sat, May 03, 2008 at 05:14:31PM +0200, Aurelien Jarno wrote: > > I am sure about that. The only difference is that /usr/sbin/update-grub > does not uses the same command, but this one instead: > > grub-probe --device-map=/boot/grub/device.map -t drive -d /dev/vda1 > > And this command: > 1) fails > 2) destroys /boot/grub/device.map Ah, I think I see the problem. Please try this patch. -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) --- ../grub2/util/biosdisk.c 2008-04-07 18:45:01.0 +0200 +++ util/biosdisk.c 2008-05-06 13:25:04.0 +0200 @@ -227,6 +227,7 @@ format = "part%d"; } else if ((strncmp (real_dev + 5, "hd", 2) == 0 + || strncmp (real_dev + 5, "vd", 2) == 0 || strncmp (real_dev + 5, "sd", 2) == 0) && real_dev[7] >= 'a' && real_dev[7] <= 'z') {
Bug#479056: grub: destroys /boot/grub/device.map
On Sat, May 03, 2008 at 03:52:26PM +0200, Robert Millan wrote: > On Sat, May 03, 2008 at 12:37:28AM +0200, Aurelien Jarno wrote: > > > - grub-mkdevicemap doesn't grok virtio devices. Could you confirm the > > > attached quick & dirty patch makes it work? Also, is this device path > > > Linux-specific? > > > > Yes that make it working. Currently virtio is only supported on Linux, > > so the device patch is Linux-specific. But that may change in the future > > Thanks. That's enough for me to add it to grub-mkdevicemap. > > > > > Searching for GRUB installation directory ... found: /boot/grub > > > > grub-probe: error: Cannot find a GRUB drive for /dev/vda1. Check your > > > > device.map. > > > > > > > > Here is the contents of /boot/grub/device.map before it is destroyed: > > > > (fd0) /dev/fd0 > > > > (hd0) /dev/vda > > [...] > > # grub-probe -t drive -d /dev/vda -v > > [...] > > (hd0) > > Now what troubles me here is that grub-probe is working now, but my patch > wasn't supposed to fix anything in it. This seems to be inconsistent with > your previous report. > > Are you completely sure that with your /boot/grub/device.map being: > > (fd0) /dev/fd0 > (hd0) /dev/vda > > and grub-common being the pristine version, grub-probe failed and (in > consequence) regenerated your device.map? > I am sure about that. The only difference is that /usr/sbin/update-grub does not uses the same command, but this one instead: grub-probe --device-map=/boot/grub/device.map -t drive -d /dev/vda1 And this command: 1) fails 2) destroys /boot/grub/device.map -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [EMAIL PROTECTED] | [EMAIL PROTECTED] `-people.debian.org/~aurel32 | www.aurel32.net -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#479056: grub: destroys /boot/grub/device.map
On Sat, May 03, 2008 at 12:37:28AM +0200, Aurelien Jarno wrote: > > - grub-mkdevicemap doesn't grok virtio devices. Could you confirm the > > attached quick & dirty patch makes it work? Also, is this device path > > Linux-specific? > > Yes that make it working. Currently virtio is only supported on Linux, > so the device patch is Linux-specific. But that may change in the future Thanks. That's enough for me to add it to grub-mkdevicemap. > > > Searching for GRUB installation directory ... found: /boot/grub > > > grub-probe: error: Cannot find a GRUB drive for /dev/vda1. Check your > > > device.map. > > > > > > Here is the contents of /boot/grub/device.map before it is destroyed: > > > (fd0) /dev/fd0 > > > (hd0) /dev/vda > [...] > # grub-probe -t drive -d /dev/vda -v > [...] > (hd0) Now what troubles me here is that grub-probe is working now, but my patch wasn't supposed to fix anything in it. This seems to be inconsistent with your previous report. Are you completely sure that with your /boot/grub/device.map being: (fd0) /dev/fd0 (hd0) /dev/vda and grub-common being the pristine version, grub-probe failed and (in consequence) regenerated your device.map? -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#479056: grub: destroys /boot/grub/device.map
On Fri, May 02, 2008 at 09:18:01PM +0200, Robert Millan wrote: > On Fri, May 02, 2008 at 03:27:38PM +0200, Aurelien Jarno wrote: > > > > Starting with version 0.97-33, /usr/sbin/update-grub destroys > > /boot/grub/device.map, > > This is (probably) intentional. When device.map doesn't contain the needed > information, it regenerates it with grub-mkdevicemap in an attempt to solve > the situation. > > > and then outputs the following error message: > > > > Searching for GRUB installation directory ... found: /boot/grub > > grub-probe: error: Cannot find a GRUB drive for /dev/vda1. Check your > > device.map. > > > > Here is the contents of /boot/grub/device.map before it is destroyed: > > (fd0) /dev/fd0 > > (hd0) /dev/vda > > > > /dev/vda corresponds to the first virtio device. > > AFAICS there are two problems here: > > - grub-mkdevicemap doesn't grok virtio devices. Could you confirm the > attached quick & dirty patch makes it work? Also, is this device path > Linux-specific? Yes that make it working. Currently virtio is only supported on Linux, so the device patch is Linux-specific. But that may change in the future > - grub-probe can't handle the conversion (once device.map is correct). I > need more information about this. Try: > grub-probe -t drive -d /dev/vda -v > and maybe also: > grub-probe -t drive -d /dev/vda -vv > # grub-probe -t drive -d /dev/vda -v grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: /dev/vda starts from 0 (hd0) # grub-probe -t drive -d /dev/vda -vv grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 grub-probe: info: the size of hd0 is 25165824 grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: opening the device `/dev/vda' grub-probe: info: the size of hd0 is 25165824 /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:220: Opening `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:312: Closing `hd0'. /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:220: Opening `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:108: Detecting gpt_partition_map... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:114: gpt_partition_map detection failed. /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:108: Detecting apple_partition_map... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/partmap/apple.c:124: partition 0: bad magic (found 0x5256; wanted 0x504d /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:114: apple_partition_map detection failed. /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:108: Detecting pc_partition_map... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/partmap/pc.c:141: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x16370eb /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/partition.c:119: pc_partition_map detection succeeded. /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/partmap/pc.c:141: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x16370eb /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:220: Opening `hd0,1'... /home/rmh/hacking/grub/svn/upload/grub2-1.96+20080429/kern/disk.c:364: Reading `hd0,1'... /home/rmh/hacking/grub/svn/uplo
Bug#479056: grub: destroys /boot/grub/device.map
On Fri, May 02, 2008 at 03:27:38PM +0200, Aurelien Jarno wrote: > > Starting with version 0.97-33, /usr/sbin/update-grub destroys > /boot/grub/device.map, This is (probably) intentional. When device.map doesn't contain the needed information, it regenerates it with grub-mkdevicemap in an attempt to solve the situation. > and then outputs the following error message: > > Searching for GRUB installation directory ... found: /boot/grub > grub-probe: error: Cannot find a GRUB drive for /dev/vda1. Check your > device.map. > > Here is the contents of /boot/grub/device.map before it is destroyed: > (fd0) /dev/fd0 > (hd0) /dev/vda > > /dev/vda corresponds to the first virtio device. AFAICS there are two problems here: - grub-mkdevicemap doesn't grok virtio devices. Could you confirm the attached quick & dirty patch makes it work? Also, is this device path Linux-specific? - grub-probe can't handle the conversion (once device.map is correct). I need more information about this. Try: grub-probe -t drive -d /dev/vda -v and maybe also: grub-probe -t drive -d /dev/vda -vv -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.) diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/grub-mkdevicemap.c ./util/grub-mkdevicemap.c --- ../grub2/util/grub-mkdevicemap.c 2008-04-07 16:34:47.0 +0200 +++ ./util/grub-mkdevicemap.c 2008-05-02 21:10:47.0 +0200 @@ -178,7 +178,7 @@ get_ide_disk_name (char *name, int unit) { #if defined(__linux__) /* GNU/Linux */ - sprintf (name, "/dev/hd%c", unit + 'a'); + sprintf (name, "/dev/vd%c", unit + 'a'); #elif defined(__GNU__) /* GNU/Hurd */ sprintf (name, "/dev/hd%d", unit);
Bug#479056: grub: destroys /boot/grub/device.map
Package: grub Version: 0.97-33 Severity: critical Justification: breaks the whole system Starting with version 0.97-33, /usr/sbin/update-grub destroys /boot/grub/device.map, and then outputs the following error message: Searching for GRUB installation directory ... found: /boot/grub grub-probe: error: Cannot find a GRUB drive for /dev/vda1. Check your device.map. Here is the contents of /boot/grub/device.map before it is destroyed: (fd0) /dev/fd0 (hd0) /dev/vda /dev/vda corresponds to the first virtio device. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.25-1-amd64 (SMP w/1 CPU core) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8) Shell: /bin/sh linked to /bin/bash -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]