Bug#595071: grub2: doesn't reckognize partioned mdraid disks

2011-04-08 Thread Vladimir 'φ-coder/phcoder' Serbinenko
tag 595071 fixed-upstream
thanks

Cleaned up version of patches applied upstream.
On 31.08.2010 22:20, Miquel van Smoorenburg wrote:
 Package: grub2
 Version: 1.98+20100804-4
 Severity: important

 Currently grub2 doesn't reckognize a system that boots from
 a partitionable mdraid disk, as I have. So the upgrade I did
 from lenny/grub-legacy to squeeze/grub2 failed.

 The main block device is called /dev/md_d0 and the partitions
 are md_d0p1, md_d0p2 etc.

 It turns out that grub2 does have all the code to make this work,
 but it looks like it hasn't been tested much and so regressed.

 It needs 2 fixes for it to work, attached as patches.

 1. grub2-md_d0-osdev.patch
A problem description and this patch (for a slightly earlier
grub version) can be found at http://savannah.gnu.org/bugs/?29903
(Original author as in the bugreport)

 2. grub2-md_d0-grubdev.patch
When grub gets the real mdraid name from mdadm, the partition
information is lost. This patch adds it back.
(Author is me)

 With these fixes applied I can grub-install /dev/md_d0 and
 have a booting system.

 Mike.


 ___
 Pkg-grub-devel mailing list
 pkg-grub-de...@lists.alioth.debian.org
 http://lists.alioth.debian.org/mailman/listinfo/pkg-grub-devel


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




signature.asc
Description: OpenPGP digital signature


Bug#595071: grub2: doesn't reckognize partioned mdraid disks

2010-12-14 Thread Rodrigo Fresneda
Hi Mike, 

I tried your patches, but I am still getting unkown filesystem from
grube-probe. Here's the ouput of grub-install /dev/md0 :

/usr/sbin/grub-probe: error: unknown filesystem.
Auto-detection of a filesystem of /dev/md0p1 failed.
Please report this together with the output of /usr/sbin/grub-probe
--device-map=/boot/grub/device.map --target=fs -v /boot/grub to
bug-g...@gnu.org


And the ouput of /usr/sbin/grub-probe
--device-map=/boot/grub/device.map --target=fs -v /boot/grub is

grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd0 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: the size of hd1 is 312581808.
grub-probe: info: changing current directory to /dev.
grub-probe: info: changing current directory to snd.
grub-probe: info: changing current directory to by-path.
grub-probe: info: changing current directory to cpu.
grub-probe: info: changing current directory to shm.
grub-probe: info: opening md/0.
grub-probe: error: unknown filesystem.

Mine is a partitioned raid1:

/dev/md0p1   1 488281319531250   83  Linux
/dev/md0p2 4882814 5126954  976564   82  Linux swap /
Solaris
/dev/md0p3 512695539071806   1357794085  Extended
/dev/md0p5 5126955 5859376 2929686   83  Linux
/dev/md0p6 5859377 6591798 2929686   83  Linux
/dev/md0p7 659179939071806   129920030   83  Linux

best regards,
rodrigo.





-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#595071: grub2: doesn't reckognize partioned mdraid disks

2010-08-31 Thread Miquel van Smoorenburg
Package: grub2
Version: 1.98+20100804-4
Severity: important

Currently grub2 doesn't reckognize a system that boots from
a partitionable mdraid disk, as I have. So the upgrade I did
from lenny/grub-legacy to squeeze/grub2 failed.

The main block device is called /dev/md_d0 and the partitions
are md_d0p1, md_d0p2 etc.

It turns out that grub2 does have all the code to make this work,
but it looks like it hasn't been tested much and so regressed.

It needs 2 fixes for it to work, attached as patches.

1. grub2-md_d0-osdev.patch
   A problem description and this patch (for a slightly earlier
   grub version) can be found at http://savannah.gnu.org/bugs/?29903
   (Original author as in the bugreport)

2. grub2-md_d0-grubdev.patch
   When grub gets the real mdraid name from mdadm, the partition
   information is lost. This patch adds it back.
   (Author is me)

With these fixes applied I can grub-install /dev/md_d0 and
have a booting system.

Mike.
diff -ruN x/grub2-1.98+20100804/util/i386/pc/grub-setup.c grub2-1.98+20100804/util/i386/pc/grub-setup.c
--- x/grub2-1.98+20100804/util/i386/pc/grub-setup.c	2010-08-04 05:40:55.0 +0200
+++ grub2-1.98+20100804/util/i386/pc/grub-setup.c	2010-08-27 18:37:31.0 +0200
@@ -824,7 +824,7 @@
   char **devicelist;
   int i;
 
-  devicelist = grub_util_raid_getmembers (dest_dev);
+  devicelist = grub_util_raid_getmembers (argv[optind]);
 
   for (i = 0; devicelist[i]; i++)
 	{
diff -ruN x/grub2-1.98+20100804/util/raid.c grub2-1.98+20100804/util/raid.c
--- x/grub2-1.98+20100804/util/raid.c	2010-06-03 01:13:14.0 +0200
+++ grub2-1.98+20100804/util/raid.c	2010-08-24 23:09:09.0 +0200
@@ -59,22 +59,15 @@
 grub_util_raid_getmembers (char *name)
 {
   int fd, ret, i, j;
-  char *devname;
   char **devicelist;
   mdu_version_t version;
   mdu_array_info_t info;
   mdu_disk_info_t disk;
 
-  devname = xmalloc (strlen (name) + 6);
-  strcpy (devname, /dev/);
-  strcpy (devname+5, name);
-
-  fd = open (devname, O_RDONLY);
+  fd = open (name, O_RDONLY);
 
   if (fd == -1)
-grub_util_error (can't open %s: %s, devname, strerror (errno));
-
-  free (devname);
+grub_util_error (can't open %s: %s, name, strerror (errno));
 
   ret = ioctl (fd, RAID_VERSION, version);
   if (ret != 0)
--- x/grub2-1.98+20100804/kern/emu/getroot.c	2010-08-02 21:44:02.0 +0200
+++ grub2-1.98+20100804/kern/emu/getroot.c	2010-08-30 15:27:20.0 +0200
@@ -657,6 +657,16 @@
 	}
 	}
 
+/* restore partition info */
+if (name 
+	!strncmp (os_dev, /dev/md_d, 9) 
+	(buf = strchr (os_dev, 'p')) != NULL)
+  {
+char *newname = malloc (strlen (name) + strlen (buf + 1) + 2);
+sprintf (newname, %s,%s, name, buf + 1);
+free (name);
+name = newname;
+  }
 out:
   close (mdadm_pipe[0]);
   waitpid (mdadm_pid, NULL, 0);