Bug#423648: grub-pc: md/lvm path check in getroot.c breaks booting

Sam Morris sam at robots.org.uk
Sun May 13 19:32:58 UTC 2007


On Sun, 2007-05-13 at 21:07 +0200, Robert Millan wrote:
> On Sun, May 13, 2007 at 06:24:19PM +0100, Sam Morris wrote:
> > Package: grub-pc
> > Version: 1.95+20070507-1
> > Severity: normal
> > 
> -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > While debugging #423022 I found the following:
> > 
> > > I had to do one more thing to boot up correctly: edit the command line.
> > > It had 'root=md0' but it needed 'root=/dev/md0'. It appears that
> > > 'grub-probe -t device /boot/grub' outputs 'md0' when it should be
> > > outputting '/dev/md0' (just as it outputs e.g., '/dev/hde1' instead of
> > > 'hde1' for 'grub-probe -t device /mnt'). Shall I file a separate bug for
> > > that?
> > 
> > This is caused by the code within the #ifdef __linux__ in
> > 'util/i386/pc/getroot.c'. I can't see what the point of this code
> > is--the kernel will always want 'root=/dev/md0' or
> > 'root=/dev/mapper/foo-bar' and not the truncated form.
> 
> grub_guess_root_device() wasn't initialy designed to serve this purpose; the
> "-t device" use was added later.
> 
> Can you try arranging this code to include the missing "/dev/" and report if
> everything still works?

Now this is more interesting. I no longer have the broken menu that I
mentioned in the other bug report! However, when I actually select one
of the entries, I get 'error: you need to load the kernel first'.

This seems to be caused by 'root' not being set in grub.cfg any more. Or
rather, it's set to an empty string. Looking closely at update-grub, I
guess changing grub_guess_root_device broke other parts of grub-probe:

        + echo 'Updating /boot/grub/grub.cfg ...'
        Updating /boot/grub/grub.cfg ...
        + cat
        ++ grub-probe --target=device /boot/grub
        + export GRUB_DEVICE=/dev/md0
        + GRUB_DEVICE=/dev/md0
        ++ grub-probe --target=drive /boot/grub
        cannot find a GRUB drive for /dev/md0.
        + export GRUB_DRIVE=
        + GRUB_DRIVE=
        ++ grub-probe --target=fs /boot/grub
        cannot find a GRUB drive for /dev/md0.
        + export GRUB_FS=
        + GRUB_FS=

BTW, grub-probe could be made more robust by putting 'set -e' at the top
rather than relying on setting it in the #! line; currently, when the
user runs 'sh -x update-grub' the -e is never enabled.

-- 
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/20070513/843a0f8e/attachment.pgp 


More information about the Pkg-grub-devel mailing list