3.3 About the GRUB 2 Boot Loader

GRUB 2 can load many operating systems in addition to Oracle Linux and it can chain-load proprietary operating systems. GRUB 2 understands the formats of file systems and kernel executables, which allows it to load an arbitrary operating system without needing to know the exact location of the kernel on the boot device. GRUB 2 requires only the file name and drive partitions to load a kernel. You can configure this information by using the GRUB 2 menu or by entering it on the command line.

Note

Do not edit the GRUB 2 configuration file directly. On BIOS-based systems, the configuration file is /boot/grub2/grub.cfg. On UEFI-based systems, the configuration file is /boot/efi/EFI/redhat/grub.cfg.

The grub2-mkconfig command generates the configuration file using the template scripts in /etc/grub.d and menu-configuration settings taken from the configuration file, /etc/default/grub.

The default menu entry is determined by the value of the GRUB_DEFAULT parameter in /etc/default/grub. The value saved allows you to use the grub2-set-default and grub2-reboot commands to specify the default entry. grub2-set-default sets the default entry for all subsequent reboots and grub2-reboot sets the default entry for the next reboot only.

If you specify a numeric value as the value of GRUB_DEFAULT or as an argument to either grub2-reboot or grub2-set-default, GRUB 2 counts the menu entries in the configuration file starting at 0 for the first entry.

To set the UEK as the default boot kernel:

  1. Display the menu entries that are defined in the configuration file, for example:

    # grep '^menuentry' /boot/grub2/grub.cfg
    menuentry 'Oracle Linux Everything, with Linux 3.10.0-123.el7.x86_64' ... {
    menuentry 'Oracle Linux Everything, with Linux 3.8.13-35.2.1.el7uek.x86_64' ... {
    menuentry 'Oracle Linux Everything, with Linux 0-rescue-052e316f566e4a45a3391cff21b4174b' ... {

    In this example for a BIOS-based system, the configuration file is /boot/grub2/grub.cfg, which contains menu entries 0, 1, and 2 that correspond to the RHCK, UEK, and the rescue kernel respectively.

  2. Enter the following commands to make the UEK (entry 1) the default boot kernel:

    # grub2-set-default 1
    # grub2-mkconfig -o /boot/grub2/grub.cfg 

    Alternatively, you can specify the value of the text of the entry as a string enclosed in quotes.

    # grub2-set-default 'Oracle Linux Everything, with Linux 3.8.13-35.2.1.el7uek.x86_64'
    # grub2-mkconfig -o /boot/grub2/grub.cfg 

For more information about using, configuring, and customizing GRUB 2, see the GNU GRUB Manual, which is also installed as /usr/share/doc/grub2-tools-2.00/grub.html.