[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#489006: debian-installer: After grub software raid installation, machine fails to boot with first drive removed or blanked.



tag 489006 patch
thanks
On Thu, 18 Jun 2009, Raphael Hertzog wrote:
> I would suggest to force install grub-pc when boot partition is on RAID
> and replace (hd0) by (md0) for installation in MBR. Maybe we need a
> supplementary check that ensures that (hd0) is part of (md0).
> 
> I might try to come up with a patch.

Here's a (raw) patch. I quickly tested it and it seems to work. I do not
check if (hd0) is part of (md0) however... you might want to
avoid entirely the problem by installing both to (hd0) and (md0).

The call to grub-mkdevicemap is needed otherwise grub-probe doesn't work.

Cheers,
-- 
Raphaël Hertzog

Contribuez à Debian et gagnez un cahier de l'admin Debian Lenny :
http://www.ouaza.com/wp/2009/03/02/contribuer-a-debian-gagner-un-livre/
diff -Nru grub-installer-1.36/grub-installer grub-installer-1.36slis1/grub-installer
--- grub-installer-1.36/grub-installer	2009-01-23 02:51:34.000000000 +0100
+++ grub-installer-1.36slis1/grub-installer	2009-06-22 12:45:42.000000000 +0200
@@ -253,9 +253,13 @@
 prefix=$(echo "$bootfs" | \
   sed 's:\(/dev/\(cciss\|ida\)/c[0-9]d[0-9]\|/dev/mmcblk[0-9]\|/dev/[a-z]\+\).*:\1:')
 
+boot_on_md=""
 case $prefix in
     /dev/md)
 	disc_offered_devfs="$bootfs"
+        grub_package="grub-pc"
+        boot_on_md="1"
+        log "Boot partition $bootfs is on RAID device, use grub-pc and (mdX) device for MBR installation."
 	;;
     /dev/mapper)
 	disc_offered_devfs="$bootfs"
@@ -312,18 +316,18 @@
 	# Note: depends on partman-efi to load the efivars module!
 	if [ -d /sys/firmware/efi ]; then
 		# This point can't be reached (yet).  See debian/isinstallable.
-		grub_package="grub-efi"
+		grub_package=${grub_package:-grub-efi}
 	else
 		# On PC/BIOS, default to GRUB Legacy
-		grub_package="grub"
+		grub_package=${grub_package:-grub}
 	fi
 	;;
     i386/*|amd64/*)
 	# On PC/BIOS, default to GRUB Legacy
-	grub_package="grub"
+	grub_package=${grub_package:-grub}
 	;;
     powerpc/*)
-	grub_package="grub-of"
+	grub_package=${grub_package:-grub-of}
 	;;
 esac
 
@@ -490,7 +494,14 @@
 		fi
 		db_get $q
 		if [ "$RET" = true ]; then
-			bootdev="(hd0)"
+                        if [ -n "$boot_on_md" ]; then
+                                if [ ! -e $ROOT/boot/grub/device.map ]; then
+                                    $chroot $ROOT grub-mkdevicemap
+                                fi
+                                bootdev=$($chroot $ROOT grub-probe -t drive -d $bootfs)
+                        else
+			        bootdev="(hd0)"
+                        fi
 			break
 		else
 			# Exit to menu if /boot is on SATA RAID/multipath; we

Reply to: