Bug#501306: update-grub fails silently with wrong device.map
Robert Millan
rmh at aybabtu.com
Mon Oct 27 19:16:58 UTC 2008
On Thu, Oct 23, 2008 at 05:45:40PM +0200, Felix Zielcke wrote:
> Attached is now an ugly patch which would display the grub-probe error
> "Check your device.map" if it fails.
>
> Else I had the idea to make an environment variable like
> GRUB_PROBE_HIDE_ERRORS=1 which would hide the output of
> grub_print_error() but then we would need to change grub-common and grub
> package to fix this bug.
>
> What do you think Robert?
Sounds like a good idea. Except that the message in first hunk is not correct
(it should say Cannot find a device for $1 or something like that).
Thanks Felix for finding a way out of this!
> Index: update-grub
> ===================================================================
> --- update-grub (revision 1080)
> +++ update-grub (working copy)
> @@ -115,7 +115,8 @@ find_device ()
> if ! test -e ${device_map} ; then
> echo quit | grub --batch --no-floppy --device-map=${device_map} > /dev/null
> fi
> - grub-probe --device-map=${device_map} -t device $1 2> /dev/null
> + grub-probe --device-map=${device_map} -t device $1 2> /dev/null || \
> + (echo "Cannot find a GRUB drive for $1. Check your device.map." && exit 1)
> }
>
> # Usage: convert_raid1 os_device
> @@ -152,7 +153,8 @@ convert () {
> if ! test -e ${device_map} ; then
> echo quit | grub --batch --no-floppy --device-map=${device_map} > /dev/null
> fi
> - GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$1" 2> /dev/null
> + GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$1" 2> /dev/null || \
> + (echo "Cannot find a GRUB drive for $1. Check your device.map." && exit 1)
> }
>
> # Usage: convert_default os_device
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
More information about the Pkg-grub-devel
mailing list