[lfs-support] Grub 2.0 problem

Bruce Dubbs bruce.dubbs at gmail.com
Mon Nov 12 18:20:11 PST 2012

Tobias Gasser wrote:
> since about 1 year i am using the same harddisk. as the procution system
> is a little outdated now, i wanted to make a 'fresh' disk.
> to boot from this disk i had to start an ubuntu livecd and install grub
> from this cd. the systems (i have built both 32bit and 64bit) can boot
> and run fine.
> but i can't install my own compiled grub as a boot-loader!
> /dev/sda1 = /boot
> /dev/sda2 = / (for 32bit)
> /dev/sda3 = / (for 64bit)
> /dev/sda4 = extended
> /dev/sda5 = SWAP
> /dev/sda6 = DATA
> booting the system with ubuntus grub works fine. running "grub install
> /dev/sda" from a chroot (dev, proc, sys are mounted with --bind) says
> everyting is fine but booting results in the grub console with:
> GRUB loading.
> Welcome to GRUB!
> error: disk 'hd0,msdos1' not found.
> Entering rescue mode...
> 'ls' just shows a newline - an empty list!
> rebooting the live-cd, reinstalling grub, putting my grub.conf into
> place - the system boots fine.
> i built grub as in the book.
> "grub-install /dev/sda" has no errors:
> Installatoin finished. no error reported
> grub from ubuntu can boot either partitions (32 or 64bit), so does grub
> from parted magic.
> i tried both grub versions i built (32/64) but none can boot, both just
> enter the console as mentionned above.
> grub.conf is very basic and works fine with grub from ubuntu and parted
> magic.
> ** cut
> set root='(hd0,1)'
> set timeout=10
> insmod ext2
> menuentry "linux 32bit" {
>     linux /boot/kernel-3.4.18-t32 root=/dev/sda2
> }
> menuentry "linux 64bit" {
>     linux /boot/kernel-3.4.18-t64 root=/dev/sda3
> }

If /boot is a separate partition, then the linux lines should look like:

linux /kernel-3.4.18-t64 root=/dev/sda3 ro

note the you don't specify /boot there.  From the viewpoint of grub, 
there is no /boot directory.

I suspect that you installed grub from ubuntu without /boot mounted as a 
separate partition.

One thing to do is to drop to the grub command line and do:

grub> ls (hd0,1)

For the ubuntu instances, try:

linux (hd0,2)/boot/kernel-3.4.18-t32 root=/dev/sda2
linux (hd0,3)/boot/kernel-3.4.18-t64 root=/dev/sda3

The trick is to know which version of the grub configuration file is 
being used.  A simple 'grub install /dev/sda' will assume that it is 
using /boot/grub/grub.cfg from where /boot is located when the install 
is run.

Check this and let us know if you need more help.

   -- Bruce

More information about the lfs-support mailing list