Configure GRUB
Server Training - Server Management

Configuration
The /boot/grub/menu.lst file allows you to set up the boot process using GRUB.  The default choice, which starts with "0" indicates which kernel should boot.  The timeout is the amount of time that the screen will be made available to make the choice of another kerenel as it boots, here the "5" indicates five seconds.

Lesson 1Lesson 3

Each aspect of the booting process starts with an argument, title, root, kernel, initird.  The title is the name of the kernel that will boot.  

title CentOS (2.6.18-128.1.16.el5)

You can edit the title to make it more friendly if you want, here it indicates the kernel version that will boot.

root is the location of the kernel.  So "(hd0,0)" indicates the first drive and the first partition contain the information for the kernel.

The kernel argument indicates the kernel that will actually be used.
kernel /vmlinuz-2.6.18-128.1.16.el5 ro root=LABEL=/

The kernel needs to reference the .img file that contains the drivers for the hardware that is on the system.  The initrd argument  points to that image file.  Note that it will have the same number as the kernel.

initrd /initrd-2.6.18-128.1.16.el5.img


default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.1.16.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.1.16.el5 ro root=LABEL=/
initrd /initrd-2.6.18-128.1.16.el5.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/
initrd /initrd-2.6.18-128.el5.img

 

User Interface
You need to be careful with grub because it it uses special syntax for disk drives because it cannot tell IDE,SATA or SCSI.  This is reflected in the BIOS limitations.  The syntax looks like this:

(device[drive number],[partition number] )

So you will see something like this, (hd0,0) which is equivalent to:

/dev/sda1    - the first drive and first partition

As you explore the user interface you will discover some challenges as the commands often do not function like you expect.

Menu Commands

This are commands that can only be used in the menu, /boot/grub/menu.lst.

default num
This will set the kernel that will boot.  In the example you see that the default is “0” or the first kernel listed.

fallback num
If the first kernel booted does not work this will send it to an alternative kernel.

hiddenmenu
If this command is used, as you see in the example below, the menu will not appear at boot time but it will be available if you hit Esc before the timeout.

timeout
This is how long in seconds before GRUB will boot the default entry.  You have this time to select an alternative during the boot.  The timeout in the example below is 5 seconds.

title
This is the start of the entry for the kernel.  The example below shows a CentOS kernel.


default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.1.16.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.1.16.el5 ro root=LABEL=/
initrd /initrd-2.6.18-128.1.16.el5.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/
initrd /initrd-2.6.18-128.el5.img