2.7. GRUB Menu Configuration File

The configuration file (/boot/grub/grub.conf), which is used to create the list of operating systems to boot in GRUB's menu interface, essentially allows the user to select a pre-set group of commands to execute. The commands given in Section 2.6 GRUB Commands can be used, as well as some special commands that are only available in the configuration file.

2.7.1. Special Configuration File Commands

The following commands can only be used in the GRUB menu configuration file:

The hash mark (#) character can be used at the beginning of a line to place comments in the menu configuration file.

2.7.2. Configuration File Structure

The GRUB menu interface configuration file is /boot/grub/grub.conf. The commands to set the global preferences for the menu interface are placed at the top of the file, followed by the different entries for each of the operating systems or kernels listed in the menu.

The following is a very basic GRUB menu configuration file designed to boot either Red Hat Linux and Microsoft Windows 2000:


# section to load linux
title Red Hat Linux (2.4.18-5.47)
        root (hd0,0)
        kernel /vmlinuz-2.4.18-5.47 ro root=/dev/sda2
        initrd /initrd-2.4.18-5.47.img

# section to load Windows 2000
title windows
        rootnoverify (hd0,0)
        chainloader +1

This file tells GRUB to build a menu with Red Hat Linux as the default operating system and sets it to autoboot after 10 seconds. Two sections are given, one for each operating system entry, with commands specific to the system disk partition table.


Note that the default is specified as a number. This refers to the first title line GRUB comes across. If you want windows to be the default, change the default=0 to default=1.

Configuring a GRUB menu configuration file to boot multiple operating systems is beyond the scope of this chapter. Please consult Section 2.11 Additional Resources for a list of additional resources.