Bug#264506: /boot/grub/stage{1,2} not read correctly

Andrew Vaughan ajv-lists at netspace.net.au
Wed Jan 25 20:21:55 UTC 2006


I took another look at this.

The problem (in my case) is in find_device ().

    # Usage: find_device file
    # Find block device on which the file resides.
    find_device () {
        # For now, this uses the program `df' to get the device name, but is
        # this really portable?
        tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^   ]*\).*%\1%p'`

This breaks when chrooted into a non-running system, if mtab doesn't reflect 
the partition layout.  (df its gets partition info from /etc/mtab.  If mtab 
reflects a different partition layout, then df reports the wrong 
partitions).

I have confirmed that manually correcting the mtab entry for / is sufficient 
for grub-install to complete.  (/boot may be needed as well, no /boot 
partition on this box).

A possible fix might be to parse /etc/fstab instead.  Attached is a patch to 
do this.  The current version does not attempt to handle partitions mounted 
using uids/labels.  Is it worthwhile trying to extend the patch, or is 
there a better approach?

Unless I hear otherwise, I'll file a bug on coreutils in a few days about 
the wrong df output.

HTH 
Andrew V.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub-patch
Type: text/x-diff
Size: 1273 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20060126/06c6c968/grub-patch.bin


More information about the Pkg-grub-devel mailing list