[lfs-support] Grub 2.0 problem

Bruce Dubbs bruce.dubbs at gmail.com
Fri Nov 16 10:50:26 PST 2012

Tobias Gasser wrote:

> what is NOT what i expect
> 1) there is no load.cfg, but maybe that's ok
> 2) the prefix is WRONG, it should be either "/boot" or "(hd0,msdos1)"
> i went back to line 642 an got
> drive: (hostdisk//dev/sda,msdos1)
> and after the sed
> partition: ,msdos1
> drive: hostdisk//dev/sda
> i now just added
> prefix_drive="(hd0,msdos1)"
> in line 717 to force the correct value
> bash-4.2# ./grub-install /dev/sda

> /usr/bin/grub-mkimage -d /usr/lib/grub/i386-pc -O i386-pc
> --output=/boot/grub/i386-pc/core.img --prefix=(hd0,msdos1)/grub biosdisk
> ext2 part_msdos
> which looks more reasonable to me.

I agree. That's what I would have done also.

>> Finally, it runs grub-setup.  See what parameters are being used for
>> that also.
> bash-4.2# ./grub-install /dev/sda
> /usr/sbin/grub-bios-setup --directory=/boot/grub/i386-pc --device-map=
> /dev/sda
> (same with and without my inserted line 717)
> i now run "grub-install /dev/sda" with my inserted line 717.
> i'll be back in either 2 minutes after sucessful reboot, or 15 minutes
> id i have to use the live-cd to reinstall grub...

I see it didn't work.

Looking at grub-mkimage --help, another thing to try is running:

/usr/bin/grub-mkimage -d /usr/lib/grub/i386-pc -O i386-pc \
   --output=/boot/grub/i386-pc/core.img biosdisk ext2 part_msdos

This omits --prefix and defaults to /boot/grub.

Another option to try is just --prefix=/grub

In any case, this command should just create core.img.

You don't mention what the following line translates to:

$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} \ 
--device-map="${device_map}" "${install_device}"

Id think it would be

/usr/sbin/grub-bios-setup --verbose --directory=/boot/grub/i386-pc  \

Another thing to try is top manually create /boot/grub/device.map.

echo "(hd0)   /dev/sda" > /boot/grub/device.map

That's a tab between the entries.

If you still can't get it to work, the next step is to dig into the 
source of grub-bios-setup.  I can help with that.

   -- Bruce

More information about the lfs-support mailing list