Product SiteDocumentation Site

23.6. Verifying the Boot Loader

When you install a kernel using rpm, the kernel package creates an entry in the boot loader configuration file for that new kernel. However, rpm does not configure the new kernel to boot as the default kernel. You must do this manually when installing a new kernel with rpm.
It is always recommended to double-check the boot loader configuration file after installing a new kernel with rpm to ensure that the configuration is correct. Otherwise, the system may not be able to boot into Red Hat Enterprise Linux properly. If this happens, boot the system with the boot media created earlier and re-configure the boot loader.
In the following table, find your system's architecture to determine the boot loader it uses, and then click on the "Refer to" link to jump to the correct instructions for your system.
Table 23.1. Boot Loaders by Architecture
Architecture Boot Loader Refer to
x86 GRUB Section 23.6.1, “Configuring the GRUB Boot Loader”
AMD® AMD64 or Intel 64® GRUB Section 23.6.1, “Configuring the GRUB Boot Loader”
IBM® eServer™ System i OS/400® Section 23.6.2, “Configuring the OS/400® Boot Loader”
IBM® eServer™ System p YABOOT Section 23.6.3, “Configuring the YABOOT Boot Loader”
IBM® System z® z/IPL

23.6.1. Configuring the GRUB Boot Loader

GRUB's configuration file, /boot/grub/grub.conf, contains a few lines with directives, such as default, timeout, splashimage and hiddenmenu (the last directive has no argument). The remainder of the file contains 4-line stanzas that each refer to an installed kernel. These stanzas always start with a title entry, after which the associated root, kernel and initrd directives should always be indented. Ensure that each stanza starts with a title that contains a version number (in parentheses) that matches the version number in the kernel /vmlinuz-<version_number> line of the same stanza.
Example 23.2. /boot/grub/grub.conf
# grub.conf generated by anaconda
[comments omitted]
default=1
timeout=0
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

title Red Hat Enterprise Linux (2.6.32-22.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-22.el6.x86_64 ro root=/dev/mapper/vg_vm6b-lv_root rd_LVM_LV=vg_vm6b/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet crashkernel=auto
        initrd /initramfs-2.6.32-22.el6.x86_64.img

title Red Hat Enterprise Linux (2.6.32-19.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-19.el6.x86_64 ro root=/dev/mapper/vg_vm6b-lv_root rd_LVM_LV=vg_vm6b/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet crashkernel=auto
        initrd /initramfs-2.6.32-19.el6.x86_64.img

title Red Hat Enterprise Linux 6 (2.6.32-17.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-17.el6.x86_64 ro root=/dev/mapper/vg_vm6b-lv_root rd_LVM_LV=vg_vm6b/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
        initrd /initramfs-2.6.32-17.el6.x86_64.img

If a separate /boot/ partition was created, the paths to the kernel and the initramfs image are relative to /boot/. This is the case in Example 23.2, “/boot/grub/grub.conf”, above. Therefore the initrd /initramfs-2.6.32-22.el6.x86_64.img line in the first kernel stanza means that the initramfs image is actually located at /boot/initramfs-2.6.32-22.el6.x86_64.img when the root file system is mounted, and likewise for the kernel path (for example: kernel /vmlinuz-2.6.32-22.el6.x86_64) in each stanza of grub.conf.

The initrd directive in grub.conf refers to an initramfs image

In kernel boot stanzas in grub.conf, the initrd directive must point to the location (relative to the /boot/ directory if it is on a separate partition), of the initramfs file corresponding to the same kernel version. This directive is called initrd because the previous tool which created initial RAM disk images, mkinitrd, created what were known as initrd files. Thus the grub.conf directive remains initrd to maintain compatibility with other tools. The file-naming convention of systems using the dracut utility to create the initial RAM disk image is: initramfs-<kernel_version>.img
Dracut is a new utility available in Red Hat Enterprise Linux 6, and much-improved over mkinitrd. For information on using Dracut, refer to Section 23.5, “Verifying the Initial RAM Disk Image”.
You should ensure that the kernel version number as given on the kernel /vmlinuz-<kernel_version> line matches the version number of the initramfs image given on the initrd /initramfs-<kernel_version>.img line of each stanza. Refer to Procedure 23.1, “Verifying the Initial RAM Disk Image” for more information.
The default= directive tells GRUB which kernel to boot by default. Each title in grub.conf represents a bootable kernel. GRUB counts the titled stanzas representing bootable kernels starting with 0. In Example 23.2, “/boot/grub/grub.conf”, the line default=1 indicates that GRUB will boot, by default, the second kernel entry, i.e. title Red Hat Enterprise Linux (2.6.32-19.el6.x86_64).
In Example 23.2, “/boot/grub/grub.conf” GRUB is therefore configured to boot an older kernel, when we compare by version numbers. In order to boot the newer kernel, which is the first title entry in grub.conf, we would need to change the default value to 0.
After installing a new kernel with rpm, verify that /boot/grub/grub.conf is correct, change the default= value to the new kernel (while remembering to count from 0), and reboot the computer into the new kernel. Ensure your hardware is detected by watching the boot process output.
If GRUB presents an error and is unable to boot into the default kernel, it is often easiest to try to boot into an alternative or older kernel so that you can fix the problem.

Important: Causing the GRUB boot menu to display

If you set the timeout directive in grub.conf to 0, GRUB will not display its list of bootable kernels when the system starts up. In order to display this list when booting, press and hold any alphanumeric key while and immediately after BIOS information is displayed, and GRUB will present you with the GRUB menu.
Alternatively, use the boot media you created earlier to boot the system.