Quick GRUB

From Gentoo Linux Wiki

Jump to: navigation, search

Contents

[edit] Introduction

This is a brief howto to install and configure GRUB bootloader. It's taken from the old Gentoo Wiki Archives.

[edit] 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 -n grub

[edit] 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) quit

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

grub's ID normal
0 hda
1 hdb
2 hdc
3 hdd


grub's ID normal partition
0 hda1
1 hda2
2 hda3

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/device.map, 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/device.map and invoke grub like this grub --device-map=/boot/grub/device.map. This will re-generate the map file considering all dynamic drives.

[edit] Step 3: The GRUB Configuration File

After this you need to edit the grub configuration file, which is located in /boot/grub/grub.conf, 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
splashimage=/boot/grub/splash.xpm.gz

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;


File: /boot/grub/grub.conf
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, at the console, you may enter:

rc-update show

[edit] See Also

[edit] External links

Personal tools
In other languages