Bug#423022: problems detecting partition map on software RAID
Sam Morris
sam at robots.org.uk
Sun May 20 13:53:47 UTC 2007
reopen 423022
thanks
Hm, this isn't quite fixed yet... users of software RAID still won't be
able to boot up, as the generated core.img will not contain the 'raid'
module.
In fact, I get the error message 'you need to load the kernel first'
which doesn't make much sense... I would have expected something more
along the lines of 'No such device: (md0)'.
Anyway, here's what I came up with for grub-install. It's ugly, but
that's shell scripting for you. ;)
# Then the partition map module.
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir}`
if test "x$partmap_module" = x -a "x$modules" = x; then
grub_device="$($grub_probe --target=device --device-map=${device_map} ${grubdir})"
dev="$(stat -c %t:%T "$grub_device")"
# Ugh, shell scripting is crap! Can't use a subshell because it can't
# update the value of partmap_module. Better hope there are never any
# kobjects that contain whitespace in their name...
for ko in $(find /sys/block -name dev -exec dirname {} \;); do
if test "$(cat "$ko/dev")" = "$dev"; then
partmap_module='pc gpt'
case "$ko" in
/sys/block/md[0-9])
partmap_module="$partmap_module raid"
;;
# Partitionable arrays are apparantly detected by grub-probe, so
# no need to check for them here.
#/sys/block/md_d[0-9])
# ;;
/sys/block/dm-[0-9])
# We should really look through the output of 'lvdisplay -c'
# at this point, searching for a LVM logical volume which
# matches the detected device's major/minor numbers.
# If that fails then we know it's not LVM; if GRUB later
# grows support for other device-mapper mappings then
# the output of 'dmsetup status' could be used here.
echo "Assuming that the device-mapper device '$ko' is part" 1>&2
echo "of an LVM logical volume. If this is not the case," 1>&2
echo "specify the correct modules with the option \`--modules'." 1>&2
partmap_module="$partmap_module lvm"
;;
*)
echo "I don't know which modules GRUB needs to use to access a" 1>&2
echo "device of type '$ko'." 1>&2
unset partmap_module
esac
break
fi
done
fi
if test "x$partmap_module" = x -a "x$modules" = x; then
echo "Auto-detection of a partition map module failed." 1>&2
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
exit 1
fi
Maybe it would be easier to simply include 'raid' and 'lvm' in the
fallback list...
--
Sam Morris
http://robots.org.uk/
PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B C869 B219 7FDB 5EA0 1078
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20070520/f327b154/attachment.pgp
More information about the Pkg-grub-devel
mailing list