Adding grub

From WolfTech
Jump to navigation Jump to search

GRUB (GRand Unified Bootloader) is a boot loader designed to launch Linux distributions such as Ubuntu or Fedora.

This tutorial shows how to enable GRUB from the command line of a Linux operating system. This is useful in setups such as dual-boot machines with Windows and Linux, as Windows XP overwrites the Master Boot Record, where GRUB resides, when it is installed. Different distributions of Linux have different recovery methods, but this tutorial deals specifically with using a Fedora Rescue CD to mount a preexisting Fedora install.

The Fedora Rescue CD is free to download. An ISO image may be found here.

To boot the Rescue CD:

1. Pull up the boot menu to interrupt the normal startup sequence. This is F12 on most Dell and Lenovo machines.

2. Select the option for the onboard CD/DVD drive.

Once the CD has booted, select the "Rescue Installed System" option. In order to enable GRUB, you must choose the "Continue" option at the next prompt, NOT the "Read-Only" option.

If the Rescue CD finds an existing Fedora install, it should leave you on a command line interface.

Before you can enable GRUB, you must change your root directory to enable certain commands. Do this by typing the following line:

"chroot /mnt/sysimage"

Now that you have changed your root directory, you may proceed with the following instructions. These instructions are modified from the site Fedora Daily Package. The specific article may be found here. The expected output is taken directly from that site and is shown in italics. User input is shown in bold.

1. Start GRUB by typing:



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

GNU GRUB version 0.97 (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.]


2. Use "find" to determine which hard drive

find /grub/grub.conf

If this command yields a "file not found" error, use this command instead:

find /boot/grub/grub.conf

This will return a string in the format "(hdX,Y)", where X is the hard drive, and Y is the partition on that hard drive.

Ex: (hd1,0) means hard drive 1, partition 0

3. Use the information from step 2 to setup GRUB

setup (hdX) where X is the hard drive number returned in the previous step.

Note that the partition is not used. This is because you are editing the boot behavior for the entire hard drive, not just Fedora.


Checking if "/boot/grub/stage1" exists... no

Checking if "/grub/stage1" exists... yes

Checking if "/grub/stage2" exists... yes

Checking if "/grub/e2fs_stage1_5" exists... yes

Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.


Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded


4. Setup is done, now exit the GRUB shell.


You may now exit the Rescue CD and restart the computer. Booting from that hard drive should now produce a GRUB menu.