Home > Oracle Linux, OS > How to set the default boot entry in Oracle Linux 7 (for example, set the UEK as the default boot kernel)?

How to set the default boot entry in Oracle Linux 7 (for example, set the UEK as the default boot kernel)?

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.
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 (sets the default entry for all subsequent reboots) and grub2-reboot (sets the default entry for the next reboot only) commands to specify the default entry.
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, first, 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.
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 
Advertisements
Categories: Oracle Linux, OS Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: