Removing the RHCK – Exploring the Various Boot Options and Kernels in Oracle Linux

Removing the RHCK

In this recipe, you will learn how to remove RHCK and its unique package dependencies while keeping all of UEK dependencies. Remember that when installing Oracle Linux, the installer automatically installs the Oracle UEK as the default kernel, but you can install RHCK for compatibility purposes.

Getting ready

Old versions of Oracle Linux required a special tool called the kernel-transition package to manage dependencies. With new versions of Oracle Linux, a much easier process is available. For example, with Oracle Linux 8, this requirement is obsolete. All packages are purposely built to avoid any dependencies with regard to the system running on a UEK or RHCK. This makes it significantly easier to remove the UEK or RHCK from the system.

How to do it…

Let’s see how to remove RHCK from our system:

  1. First, let’s check all kernels running within our system by using the grubby command:

Figure 3.19 – Checking the kernels

We can see in the preceding output that the default kernel in use is /boot/vmlinuz-5.15.0-8.91.4.1.el8uek.x86_64, which is a UEK; also, we can see that we have a couple of RHCKs installed, /boot/vmlinuz-4.18.0-425.13.1.el8_7.x86_64 and /boot/vmlinuz-4.18.0-425.3.1.el8.x86_64, that we can safely remove.

2. Now that we know that we are using a UEK, we can safely remove the desired RHCK using the dnf remove kernel command as recommended in the Oracle Linux manual. It will detect the unused kernels and show the dependencies within them.

Figure 3.20 – dnf remove kernel

3. As you can see in the preceding screenshot, both installed RHCKs were detected and deleted from the system. Now, let’s run the grubby command again to see whether the RHCKs were really removed from our system boot options.

Warning

Do not run dnf remove kernel a second time. This may accidentally remove the booting kernel, resulting in a system that will no longer boot.

Figure 3.21 – RHCK removed

Sadly, both kernels are still there. The RHCK kernel-<version> package is merely a metadata package containing no files. It is intended to ensure all dependent kernel packages are correctly installed. So, in other words, removing the “kernel-<version>.el8” RPM does not remove any of the kernel-subpackages, which includes the packages that update the /boot associated files and the boot loader entries.

To solve this situation, we need to remove the corresponding kernel-core-<version> packages containing the /boot/ and all kernel-related files/directories.

4. As shown in the following screenshot, we will use the dnf erase kernel-core command to remove all related kernel-core packages:

Figure 3.22 – dnf erase kernel-core

Now, let’s rerun the grubby command to see whether the RHCKs were removed this time from our system:

Figure 3.23 – grubby post RHCK removal

As you can now see, all RHCKs were removed from our system.

Furthermore, if you later decide to restore the deleted RHCKs, you can quickly restore them using the dnf install kernel command:

Figure 3.24 – Reinstalling the RHCK

As you can see, with Oracle Linux, switching kernels is a simple task, as is removing kernels from the operating system. When you have a chance, compare the system performance between the RHCK and UEKs; you will be pleasantly surprised how much faster tasks such as I/O are with the more modern UEK.

Leave a Reply

Your email address will not be published. Required fields are marked *

All Rights Reserved 2022-2024