Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc


Step 1: Install GRUB

Install grub:

# emerge -n grub
Note: Sometimes grub halts to "Booting grub, please wait.."
In this case, or to prevent it from possibly happening, remove the CFLAGS for the emerge.
# CFLAGS="" emerge grub

Step 2: The GRUB Prompt

A user may decided to use grub-install or they can set up grub manually.

After it finishes installing then run the GRUB prompt:

 # grub

Once you're in the prompt type the following in order:

 root (hdx,y)
 setup (hdx)

Of course don't actually put in (hdx,y). Replace x with the hard drive type and location.

grub's IDnormal
grub's IDnormal partition

hda is the common device for an IDE disk, a subsequent drive will be hdb, or sda if you have no IDE hard disk. ID numbering starts at 0 for the "first" hard-disk.

The mapping of device against grub number is listed in /boot/grub/, so /dev/sda1 can very well end up in (hd2,0).

You can use grubs auto-complete feature to discover what partitions/drives it sees. When you type in the root command, hit the tab key twice

root (hd<TAB><TAB>

If the drive does not show up in the map file and you deal with dynamically attached devices such as USB memory, do the following: delete /boot/grub/ and invoke grub like this grub --device-map=/boot/grub/ This will re-generate the map file considering all dynamic drives.

Step 3: The GRUB Configuration File

After this you need to edit the grub.conf file which is located in /boot/grub and you can get to it by using your favorite editor.

 nano /boot/grub/grub.conf

If this comes up blank, your boot partion is probably not mounted. Try:

mount /dev/hda1 /boot
nano /boot/grub/grub.conf 

note: You must be root to edit this file (obviously).

This is a sample configuration:

File: /boot/grub/grub.conf
timeout 30
default 0
fallback 1

title Gentoo Linux
kernel (hd0,0)/boot/vmlinuz-2.6.10-gentoo-r1 root=/dev/hda2

title Windows
rootnoverify (hd1,0)
chainloader +1

Gentoo also permits run level to be set using text names, not the standard numbers (although the names to map to numbers). To do this, use the softlevel variable. e.g. to boot to runlevel user;

title Gentoo Linux
kernel (hd0,0)/boot/vmlinuz-2.6.10-gentoo-r1 root=/dev/hda2 softlevel=user

To see the services that will be started for each level, enter;

# rc-update show

at the console.

See Also

External links

Last modified: Mon, 01 Sep 2008 10:59:00 +0000 Hits: 61,851