Changing the default kernel in Oracle Linux | It's as simple as 1-2-3

August 10, 2022 | 2 minute read
Gursewak Sokhi
Technical Product Manager - Oracle Linux & Virtualization
Text Size 100%:

Oracle Linux comes with a choice of two kernels, the Unbreakable Enterprise Kernel (UEK), which is installed and enabled by default, and the Red Hat Compatible Kernel (RHCK). Whether customers select UEK for its support of the latest hardware, extensive security features, and superior performance, or RHCK, Oracle Linux remains fully application binary compatible with Red Hat Enterprise Linux (RHEL). 

In previous releases, setting the default kernel was performed by configuring the GRUB boot loader. Now, however, for Oracle Linux 7.0 and later, we take advantage of the GRUB 2 boot loader; GRUB 2 understands the formats of file systems and kernel executables, allowing it to load an operating system without needing to know the exact location of the kernel on the boot device. 

Below we use Oracle Linux 9 to detail how easily you can change the default kernel (UEK) and boot into RHCK. The steps showcased can be replicated for any version of Oracle Linux 7.0 and later. 

How to change the default kernel

It's simple, the grubby command allows you to control and manage all your boot requirements; it offers the benefit of being scriptable and can abstract the bootloader configuration from you, the user.

  1. To check which kernel is already configured as the current default kernel to use at boot, run the grubby --default-kernel command. To additionally check which kernel is currently running on your system, use the uname -r command. 
    The Oracle Linux 9 instance shown below has UEK configured to be the default kernel to use at boot and is currently running UEK on the system. 

    [root@oracle-linux-9-instance ~]# grubby --default-kernel
    [root@oracle-linux-9-instance ~]# uname -r
  2. Display all the kernels that are installed and configured on your system by using the grubby --info=ALL | grep ^kernel command. If you would like to retrieve more information about the boot configuration associated with each kernel in the system’s /boot directory, you may simply remove the piping of the output through grep and just run grubby --info=ALL.
    Oracle Linux kernel names indicate which kernel it is, RHCK or UEK, and the system architecture. In the example below, the el9 suffix indicates RHCK, while el9uek indicates UEK.

    [root@oracle-linux-9-instance ~]# grubby --info=ALL | grep ^kernel
  3. Change to a different default kernel by running the grubby --set-default command with the specific kernel that you choose to run after rebooting. Below we are changing the default kernel to RHCK (5.14.0-70.13.1.el9_0.x86_64).
    The change takes effect immediately, so all that is left to do is reboot your system.

    [root@oracle-linux-9-instance ~]# grubby --set-default /boot/vmlinuz-5.14.0-70.13.1.el9_0.x86_64
    The default is /boot/loader/entries/9fe05f6ac8e542f5b4d932bbe21e58d5-5.14.0-70.13.1.el9_0.x86_64.conf with index 1 and kernel /boot/vmlinuz-5.14.0-70.13.1.el9_0.x86_64

    The changed default kernel that you choose persists across system reboots. Therefore, after rebooting the instance, your system will be running the kernel that you chose.

    [root@oracle-linux-9-instance ~]# uname -r


Additional Resources

Gursewak Sokhi

Technical Product Manager - Oracle Linux & Virtualization

Gursewak Sokhi is a Technical Product Manager for Oracle Linux and Virtualization. He holds a Computer Engineering B.S. with a concentration in Systems Programming, and a Mathematics and Economics B.A. from the University of California, Santa Cruz.

Connect with him on LinkedIn:

Previous Post

Why Oracle Database runs best on Oracle Linux

Julie Wong | 2 min read

Next Post

Oracle Linux and BPF

Alan Maguire | 7 min read