Bug#489006: #489006 debian-installer: After grub software raid installation, machine fails to boot with first drive removed or blanked
Hi,
i've made a (very) slight modification to Raphael's patch so it can be applied
against current grub-installer code.
So here it goes for review.
--
Melhores cumprimentos/Best regards,
Miguel Figueiredo
http://www.DebianPT.org
diff --git a/grub-installer b/grub-installer
index fe33471..784dc41 100755
--- a/grub-installer
+++ b/grub-installer
@@ -223,10 +223,14 @@ esac
rootfs_nodevfs=$(mapdevfs $rootfs)
bootfs_nodevfs=$(mapdevfs $bootfs)
prefix=$(device_to_disk "$bootfs")
+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 a RAID device, use grub-pc and (mdX) device for installation."
;;
/dev/mapper)
disc_offered_devfs="$bootfs"
@@ -537,11 +541,18 @@ fi
# Try to avoid using (hd0) as a boot device name. Something which can be
# turned into a stable by-id name is better.
-default_bootdev_os="$($chroot $ROOT grub-mkdevicemap --no-floppy -m - | head -n1 | cut -f2)"
-if [ "$default_bootdev_os" ]; then
- default_bootdev="$($chroot $ROOT readlink -f "$default_bootdev_os")"
+# Use md0 for RAID instead of sda as it installs on every drive. See #489006.
+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
- default_bootdev="(hd0)"
+ default_bootdev_os="$($chroot $ROOT grub-mkdevicemap --no-floppy -m - | head -n1 | cut -f2)"
+ if [ "$default_bootdev_os" ]; then
+ default_bootdev="$($chroot $ROOT readlink -f "$default_bootdev_os")"
+ else
+ default_bootdev="(hd0)"
fi
# Set a sensible default boot device, so that we aren't installing GRUB to
@@ -586,7 +597,14 @@ while : ; do
fi
db_get $q
if [ "$RET" = true ]; then
- bootdev="$default_bootdev"
+ 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="$default_bootdev"
+ fi
break
else
# Exit to menu if /boot is on SATA RAID/multipath; we
Reply to: