3.2.1 About the GRUB Configuration File

The GRUB configuration file, /boot/grub/grub.conf, starts with the default, timeout, splashimage, and hiddenmenu directives:

default

Specifies the kernel entry that GRUB should boot by default. GRUB counts the kernel entries in the configuration file starting at 0. The directive default=0 means that GRUB boots the first kernel entry by default, unless you override this action. If you have installed the Unbreakable Enterprise Kernel, it is configured as the first entry, and the Red Hat Compatible Kernel is configured as the second entry. Changing the value of default to 1 would cause GRUB to boot the Red Hat Compatible Kernel by default.

timeout

Specifies the number of seconds that GRUB should wait for keyboard input before booting the default kernel. Pressing any alphanumeric key within this period displays the GRUB menu. The default timeout is 5 seconds. A value of 0 causes GRUB to boot the default kernel immediately. A value of -1 or no value at all causes GRUB to wait indefinitely until you press a key.

splashimage

Specifies the splash screen that hides boot messages. Pressing Esc bypasses the splash screen. The default splash image is (hd0,0)/grub/splash.xpm.gz, which is a gzipped, xpm-format file.

hiddenmenu

If specified, instructs GRUB not to display the GRUB menu by default unless a key is pressed.

password

If specified with the arguments --md5 pwhash, specifies the MD5 hash of a GRUB password generated using the /sbin/grub-md5-crypt command. See Section 3.2.2, “Configuring a GRUB Password”.

Following these directives are title entries that represent each bootable Oracle Linux kernel or other operating system partition.

For Linux systems, the title contains a description of the kernel and the kernel version number in parentheses. Each title is followed by root, kernel, initrd, and optional lock directives, which should be indented:

lock

If specified, you must enter the correct GRUB password to boot the specified kernel or operating system. See Section 3.2.2, “Configuring a GRUB Password”.

root

Specifies the root partition, which can be on a local disk or on a SAN-attached disk. The first hard drive detected by the BIOS is named hd0, the second is named hd1, and so on. The partitions on a disk are numbered from 0. For example, root (hd0,1) specifies the first detected disk and the second partition on that disk. The mapping between BIOS-detected disks and device files is stored in /boot/grub/device.map, for example:

# cat /boot/grub/device.map 
# this device map was generated by anaconda
(hd0)     /dev/sda
kernel

Specifies the kernel version to be booted as a path relative to the root of the boot partition, together with any kernel boot parameters. See Section 3.2.1.1, “Kernel Boot Parameters”.

initrd

Specifies the initramfs file as a path relative to the root of the boot partition. The kernel uses this file to create the initial root file system that it mounts before the real root file system. The purpose of the initial root file system is to allow the kernel to preload driver modules for IDE, SCSI, RAID and other devices, so that it can access and mount the real root file system. After the newly-loaded kernel has complete access to the real root file system, it switches over to using it.

initramfs files accompany kernel distributions and usually have the same version number as the kernel that they support. You would not usually need to change or modify an initramfs file unless you build a kernel to support a new device driver module.

Note

The name initrd is a legacy of when the initial root file system was provided as a file system image. The initramfs file is actually a cpio archive.

The following sample entries are taken from a GRUB configuration file:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Oracle Linux Server (3.6.39-400.17.1.el6uek.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.39-400.17.1.el6uek.x86_64 ro root=/dev/mapper/VolGroup-lv_root 
rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap 
SYSFONT=latarcyrheb-sun16  rd_LVM_LV=VolGroup/lv_root rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.39-400.17.1.el6uek.x86_64.img
title Oracle Linux Server (2.6.32-358.0.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-358.0.1.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root 
rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap 
SYSFONT=latarcyrheb-sun16  rd_LVM_LV=VolGroup/lv_root rd_NO_DM rhgb quiet crashkernel=auto
        initrd /initramfs-2.6.32-358.0.1.el6.x86_64.img

In this example, the default kernel is the Unbreakable Enterprise Kernel (3.6.39-400.17.1.el6uek.x86_64) and the other bootable kernel is the Red Hat Compatible Kernel (2.6.32-358.0.1.el6.x86_64). As this system has a separate boot partition, the paths of the kernel and initrd files are given relative to the root of that partition.