Chapter 2. Specifying the RHEL kernel to run

You can boot any installed kernel, standard or Real Time. You can select the required kernel manually in the GRUB menu during booting. You can also configure which kernel boot by default.

When the real-time kernel is installed, it is automatically set to be the default kernel and is used on the next boot.

2.1. Displaying the default kernel

You can display the kernel configured to boot by default.

Procedure

  • To view the default kernel:

    ~]# grubby --default-kernel
    /boot/vmlinuz-4.18.0-80.rt9.138.el8.x86_64

    The rt in the output of the command shows that the default kernel is a real time kernel.

2.2. Displaying the running kernel

You can display the currently running kernel

Procedure

  • To show which kernel the system is currently running.

    ~]# uname -a
    Linux rt-server.example.com 4.18.0-80.rt9.138.el8.x86_64 …
    Note

    When the system receives a minor update, for example, from 8.3 to 8.4, the default kernel might automatically change from the Real Time kernel back to the standard kernel.

2.3. Configuring kernel-rt as the default boot kernel

On a newly installed system, the stock RHEL kernel is set as the default boot kernel and is used as the default kernel on the next boot and subsequent system updates. You can change this configuration and set kernel-rt as the default kernel to boot with and also make this configuration persistent across the system updates. Configuring kernel-rt is a one-time procedure, which you can change or revert to another kernel if necessary. You can also configure other existing kernels variants, such as, kernel, kernel-debug, or kernel-rt-debug, as the default boot kernel.

Procedure

  1. To configure kernel-rt as the default boot kernel, enter the following command:

    # grubby --set-default=<RT_VMLINUZ>

    RT_VMLINUZ is the name of the vmlinux file that is associated with the kernel-rt kernel. For example:

    # grubby --set-default=/boot/vmlinuz-5.14.0-284.11.1.rt14.296.el9_2.x86_64+rt
  2. To configure kernel-rt as default boot kernel on system updates, enter the following command:

    # sed -i ‘s/UPDATEDEFAULT=.*/UPDATEDEFAULT=yes/g’/etc/sysconfig/kernel
    # sed -i 's/DEFAULTKERNEL=.*/DEFAULTKERNEL=kernel-rt-core/g'/etc/sysconfig/kernel

    The UPDATEDEFAULT variable when specified as yes, sets the default kernel to change with system updates.

    In the example output, the path for the default kernel is specific to the kernel-rt-core package installed. You can determine the path to the kernel from a package by using the rpm -q kernel-rt-core command.

    1. Optional: If you need to determine the path to the kernel from a package, first list the installed packages:

      # rpm -q kernel-rt-core
        kernel-rt-core-5.14.0-284.11.1.rt14.296.el9_2.x86_64
        kernel-rt-core-5.14.0-284.10.1.rt14.295.el9_2.x86_64
        kernel-rt-core-5.14.0-284.9.1.rt14.294.el9_2.x86_64
    2. To use the latest installed package as the default, enter the following command to find the path to the boot image from that package:

      # rpm -ql kernel-rt-core-5.14.0-284.11.1.rt14.296.el9_2.x86_64|grep‘^/boot/vmlinu’
      /boot/vmlinuz-5.14.0-284.11.1.rt14.296.el9_2.x86_64.x86_64+rt
    3. To configure kernel-rt as the default boot kernel, enter the following command:

      # grubby --set-default=/boot/vmlinuz-5.14.0-284.11.1.rt14.296.el9_2.x86_64.x86_64+rt

Verification

  • To verify kernel-rt is the default kernel, enter the following command:

    # grubby --default-kernel
    /boot/vmlinuz-5.14.0-284.11.1.rt14.296.el9_2.x86_64.x86_64+rt