Chapter 3. Customizing the boot menu

This section provides information about what the Boot menu customization is, and how to customize it.

Prerequisites:

For information about downloading and extracting Boot images, see Extracting Red Hat Enterprise Linux boot images

The Boot menu customization involves the following high-level tasks:

  1. Complete the prerequisites.
  2. Customize the Boot menu.
  3. Create a custom Boot image.

3.1. Customizing the boot menu

The Boot menu is the menu which appears after you boot your system using 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. To customize the Boot menu, you can:

  • Customize the default options.
  • Add more options.
  • Change the visual style (color and background).

An installation media consists of ISOLINUX and GRUB2 boot loaders. The ISOLINUX boot loader is used on systems with BIOS firmware, and the GRUB2 boot loader is used on systems with UEFI firmware. Both the boot loaders are present on all Red Hat images for AMD64 and Intel 64 systems.

Customizing the boot menu options can especially be 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 to add the inst.ks= boot option. You can add this option to one of the pre-configured entries, if you edit boot loader configuration files on the media.

3.2. Systems with bios firmware

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

Figure 3.1. ISOLINUX Boot Menu

The ISOLINUX boot menu used on systems with BIOS firmware in its default configuration.

The isolinux/isolinux.cfg configuration file on the boot media contains directives for setting the color scheme and the menu structure (entries and submenus).

In the configuration file, the default menu entry for Red Hat Enterprise Linux, Test this media & Install Red Hat Enterprise Linux  9, is defined in the following block:

label check
  menu label Test this ^media & install Red Hat Enterprise Linux 9.
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-9-BaseOS-x86_64 rd.live.check
quiet

Where:

  • menu label - determines how the entry will be named in the menu. The ^ character determines its keyboard shortcut (the m key).
  • menu default - provides a default selection, 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.

    For information about the options that are applicable to Anaconda refer to Red Hat Enterprise Linux 9 Performing a standard RHEL 9 installation Guide.

    One of the notable options is inst.ks=, which allows you to specify a location of a Kickstart file. You can place a Kickstart file on the boot ISO image and use the inst.ks= option to specify its location; for example, you can place a kickstart.ks file into the image’s root directory and use inst.ks=hd:LABEL=RHEL-9-BaseOS-x86_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-9-BaseOS-x86_64 option above), replace all spaces with \x20.

Other important options which are not included in the menu entry definition are:

  • timeout - determines the time for which the boot menu is displayed before the default menu entry is automatically used. The default value is 600, which means the menu is displayed for 60 seconds. Setting this value to 0 disables the timeout option.

    Note

    Setting the timeout to a low value such as 1 is useful when performing a headless installation. This helps to avoid the 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) looks 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-9-BaseOS-x86_64 rescue quiet
    
    menu separator
    
    label returntomain
      menu label Return to ^main menu
      menu exit
    
    menu end

    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 returns 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 that 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.
  • foreground and background - determine the actual colors.

    The colors are described using an #AARRGGBB notation in hexadecimal format determines opacity:

  • 00 for fully transparent.
  • ff for fully opaque.
  • menu help textfile - creates a menu entry which, when selected, displays a help text file.

Additional resources

  • For a complete list of ISOLINUX configuration file options, see the Syslinux Wiki.

3.3. Systems with uefi firmware

The GRUB2 boot loader is used on systems with UEFI firmware.

The EFI/BOOT/grub.cfg configuration file on the boot media contains a list of preconfigured menu entries and other directives which controls the appearance and the Boot menu functionality.

In the configuration file, the default menu entry for Red Hat Enterprise Linux (Test this media & install Red Hat Enterprise Linux 9) is defined in the following block:

menuentry 'Test this media & install Red Hat Enterprise Linux 9' --class fedora --class gnu-linux --class gnu --class os {
    linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-9-BaseOS-x86_64 rd.live.check quiet
    initrdefi /images/pxeboot/initrd.img
}

Where:

  • menuentry - Defines the title of the entry. It is specified in single or double quotes (' or "). You can use the --class option to group menu entries into different classes, which can then be styled differently using GRUB2 themes.

    Note

    As shown in the above example, you must enclose each menu entry definition in curly braces ({}).

  • linuxefi - Defines the kernel that boots (/images/pxeboot/vmlinuz in the above example) and the other additional options, if any.

    You can customize these options to change the behavior of the boot entry. For details about the options that are applicable to Anaconda, see

Red Hat Enterprise Linux 9 Performing an advanced RHEL 9 installation.

+ One of the notable options is inst.ks=, which allows you to specify a location of a Kickstart file. You can place a Kickstart file on the boot ISO image and use the inst.ks= option to specify its location; for example, you can place a kickstart.ks file into the image’s root directory and use inst.ks=hd:LABEL=RHEL-9-BaseOS-x86_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-9-BaseOS-x86_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 is the boot menu displayed before the default menu entry is automatically used. The default value is 60, which means the menu is 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 immediately activates the default boot entry.

  • submenu - A submenu block allows you to create a sub-menu and group some entries under it, instead of displaying them in the main menu. The Troubleshooting submenu in the default configuration 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-9-BaseOS-x86_64 xdriver=vesa nomodeset quiet
        initrdefi /images/pxeboot/initrd.img
      }
      menuentry 'Submenu option 2' {
        linuxefi /images/vmlinuz inst.stage2=hd:LABEL=RHEL-9-BaseOS-x86_64 rescue quiet
        initrdefi /images/initrd.img
      }
    }
  • set default - Determines the default entry. The entry numbers start from 0. If you want to make the third entry the default one, use set default=2 and so on.
  • theme - determines the directory which contains GRUB2 theme files. You can use the themes to customize visual aspects of the boot loader - background, fonts, and colors of specific elements.

Additional resources