Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

3. Customizing the Boot Menu

This section contains information necessary for customizing the boot menu - the menu which appears after you boot your system from an installation image. Normally, this menu allows you to choose between options such as Install Red Hat Enterprise Linux, Boot from local drive or Rescue an installed system. These options can be customized and additional options can be added, and the visual style (colors and background) can be changed.
There are two different boot loaders on installation media. The ISOLINUX boot loader is used on systems with BIOS firmware, and the GRUB2 boot loader is used on systems with UEFI firmware. Both are present on all images for AMD64 and Intel 64 systems provided by Red Hat.
Customizing boot menu options can be especially useful with Kickstart. Kickstart files must be provided to the installer before the installation begins. Normally, this is done by manually editing one of the existing boot options and adding the inst.ks= boot option; if you edit boot loader configuration files on the media, you can add this option to one of the pre-configured entries.
Before you begin customizing the boot loader, follow Procedure 1, “Extracting ISO Images” to unpack the ISO image you want to modify into a working directory. After you finish your modifications, follow Procedure 3, “Creating ISO Images” to create a new bootable ISO image.

3.1. Systems with BIOS Firmware

The ISOLINUX boot loader is used on systems with BIOS firmware.
ISOLINUX Boot Menu

Figure 1. ISOLINUX Boot Menu

The isolinux/isolinux.cfg configuration file on the boot media contains directives for setting the color scheme and the structure of the menu (entries and submenus).
In the configuration file, the default menu entry for Red Hat Enterprise Linux, Test this media & Install Red Hat Enterprise Linux 7, is defined in the following block:
label check
  menu label Test this ^media & install Red Hat Enterprise Linux 7.1
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 rd.live.check quiet
Notable options in the above example are:
  • menu label - determines how the entry will be named in the menu. The ^ character determines its keyboard shortcut (the m key).
  • menu default - makes this option selected by default, even though it is not the first option in the list.
  • kernel - loads the installer kernel. In most cases it should not be changed.
  • append - contains additional kernel options. The initrd= and inst.stage2 options are mandatory; you can add others.
    Usable options which are specific to Anaconda are listed in the Red Hat Enterprise Linux 7 Installation Guide. One of the notable options is inst.ks=, which allows you to specify a location of a Kickstart file. Therefore, you can place a Kickstart file on the boot ISO image and use this option to use it; for example, you can place a file named kickstart.ks into the image's root directory and use inst.ks=hd:LABEL=RHEL-7.1\x20x86_64:/kickstart.ks.
    You can also use dracut options which are listed on the dracut.cmdline(7) man page.

    Important

    When using a disk label to refer to a certain drive (as seen in the inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 option above), replace all spaces with \x20.
Other important options which are not part of menu entry definitions include:
  • timeout - determines how long will the boot menu displayed before the default menu entry is automatically used. The default value it 600, which means the menu will be displayed for 60 seconds. Setting this value to 0 disables the timeout completely.

    Note

    Setting the timeout to a low value such as 1 is useful when performing a headless installation as you will not have to wait for the 60 second default timeout to finish.
  • menu begin and menu end - determines a start and end of a submenu block, allowing you to add additional options such as troubleshooting and grouping them in a submenu. A simple submenu with two options (one to continue and one to go back to the main menu) will look similar to the following:
    menu begin ^Troubleshooting
      menu title Troubleshooting
    
    label rescue
      menu label ^Rescue a Red Hat Enterprise Linux system
      kernel vmlinuz
      append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 rescue quiet
    
    menu separator
    
    label returntomain
      menu label Return to ^main menu
      menu exit
    
    menu end
    As you can see in the above example, the submenu entry definitions are similar to normal menu entries, but grouped between menu begin and menu end statements. The menu exit line in the second option exits the submenu and goes back to the main menu.
  • menu background - the menu background. Can either be a solid color (see menu color below), or an image in a PNG, JPEG or LSS16 format. When using an image, make sure its dimensions correspond to the resolution set using the set resolution statement. Default dimensions are 640x480.
  • menu color - determines the color of a menu element. The full format is:
    menu color element ansi foreground background shadow
    Most important parts of this command are element (determines which element the color will apply to) and foreground and background which determine the actual colors. Colors are described using an #AARRGGBB notation in hexadecimal format; the first pair of digits (AA) determines opacity (00 for fully transparent, ff for fully opaque).
    See the Syslinux Wiki for detailed information about available elements, ANSI values, shadow settings and other visual customization options.
  • menu help textfile - creates a menu entry which, when selected, displays a help text file.
For a complete list of ISOLINUX configuration file options, see the Syslinux Wiki.

3.2. Systems with UEFI Firmware

The GRUB2 boot loader is used on systems with UEFI firmware.
The GRUB2 configuration file is EFI/BOOT/grub.cfg on the boot media. The configuration file contains a list of preconfigured menu entries and other directives which control the appearanace and functionality of the boot menu.
In the configuration file, the default menu entry for Red Hat Enterprise Linux (Test this media & install Red Hat Enterprise Linux 7.1) is defined in the following block:
menuentry 'Test this media & install Red Hat Enterprise Linux 7.1' --class fedora --class gnu-linux --class gnu --class os {
  linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 rd.live.check quiet
  initrdefi /images/pxeboot/initrd.img
}
Notable options in the above example are:
  • menuentry - the option that defines the menu entry. The title of the entry is in single or double quotes (' or "). The --class option can be used to group menu entries into different classes, which can then be styled differently using GRUB2 themes.

    Note

    Each menu entry definition must be enclosed in curly braces ({}) as shown in the above example.
  • linuxefi - this option defines which kernel will be booted (/images/pxeboot/vmlinuz in the above example) as well as additional options. Customize these options to change the behavior of the boot entry.
    Usable options which are specific to Anaconda are listed in the Red Hat Enterprise Linux 7 Installation Guide. One of the notable options is inst.ks=, which allows you to specify a location of a Kickstart file. Therefore, you can place a Kickstart file on the boot ISO image and use this option to use it; for example, you can place a file named kickstart.ks into the image's root directory and use inst.ks=hd:LABEL=RHEL-7.1\x20x86_64:/kickstart.ks.
    You can also use dracut options which are listed on the dracut.cmdline(7) man page.

    Important

    When using a disk label to refer to a certain drive (as seen in the inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 option above), replace all spaces with \x20.
  • initrdefi - location of the initial RAM disk (initrd) image to be loaded.
Other options used in the grub.cfg configuration file are:
  • set timeout - determines how long will the boot menu displayed before the default menu entry is automatically used. The default value it 60, which means the menu will be displayed for 60 seconds. Setting this value to -1 disables the timeout completely.

    Note

    Setting the timeout to 0 is useful when performing a headless installation, because this setting will immediately activate the default boot entry.
  • submenu - definition of a submenu block. This allows you to create a sub-menu and group some entries under it, instead of displaying them in the main menu. In the default configuration, there is a Troubleshooting submenu which contains entries for rescuing an existing system.
    The title of the entry is in single or double quotes (' or ").
    The submenu block contains one or more menuentry definitions as described above, and the entire block is enclosed in curly braces ({}). For example:
    submenu 'Submenu title' {
      menuentry 'Submenu option 1' {
        linuxefi /images/vmlinuz inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 xdriver=vesa nomodeset quiet
        initrdefi /images/pxeboot/initrd.img
      }
      menuentry 'Submenu option 2' {
        linuxefi /images/vmlinuz inst.stage2=hd:LABEL=RHEL-7.1\x20x86_64 rescue quiet
        initrdefi /images/initrd.img
      }
    }
  • set default - this option determines which entry will be selected by default. Note that entry numbers start from 0; if you want to make the third entry the default one, use set default=2, etc.
  • theme - location of a directory which contains a GRUB2 theme files. Themes can be used to customize visual aspects of the boot loader - background, fonts, and colors of specific elements.
    Full description of the theme file format is beyond the scope of this document. For information about creating custom themes, see the GNU GRUB Manual 2.00.
For additional information about customizing the boot menu, see the GNU GRUB Manual 2.00. Also see the Red Hat Enterprise Linux 7 System Administrator's Guide for more general information about GRUB2.