Previous Section  < Day Day Up >  Next Section

Recipe 12.3. Installing GRUB Without a Floppy Disk

12.3.1 Problem

You would like to install GRUB, but your system does not have a floppy drive. Or you have a floppy drive but can't find a usable floppy disk.

12.3.2 Solution

Use GRUB's own command shell to set it up.

First, install GRUB, or upgrade to the latest version. To get the version number, use:

$ grub —version

grub (GNU GRUB 0.94)

Next, take a few preparatory steps:

  1. Make a hard copy of your partition table (fdisk -l | lpr).

  2. Make a hard copy of lilo.conf.

  3. Back up your data and have a rescue disk, like Knoppix, at hand.

  4. Leave your LILO installation intact, in case you want it back.

Then open a root shell on your Linux system, and start up a GRUB shell:

# grub

Probing devices to guess BIOS drives. This may take a long time.

   

GNU GRUB  version 0.94  (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported.  For the first word, TAB lists possible 

command completions. Anywhere else TAB lists the possible completions of a 

device/filename. ]

   

grub>

Find the stage1 loader:

grub> find /boot/grub/stage1

 (hd0,0)

Now run these three commands:

grub> root (hd0,0)

grub> setup (hd0)

grub> quit

Reboot, and you will be greeted by the GRUB command shell.

You'll probably want to boot into Linux and create a GRUB boot menu. See Recipe 12.7 and Section 12.9 to learn how to do this.

12.3.3 Discussion

This is what happened with those three little commands:

grub> root (hd0,0)
Set the root device.
grub> setup (hd0)
Install GRUB to the MBR.
grub> quit
Exit GRUB.


You will see output similar to this:

grub> root (hd0,0)

 Filesystem type is reiserfs, partition type 0x83

   

grub> setup (hd0)

 checking if "/boot/grub/stage1" exists...yes

 checking if "/boot/grub/stage2" exists...yes

 checking if "/boot/grub/e2fs_stage1_5" exists...yes

 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15

 sectors are embedded. 

 Succeeded.

 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p

 (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"...Succeeded

   

grub> quit

12.3.4 See Also

    Previous Section  < Day Day Up >  Next Section