Chapter 1. The Linux kernel
Learn about the Linux kernel and the Linux kernel RPM package provided and maintained by Red Hat (Red Hat kernel). Keep the Red Hat kernel updated, which ensures the operating system has all the latest bug fixes, performance enhancements, and patches, and is compatible with new hardware.
1.1. What the kernel is
The kernel is a core part of a Linux operating system that manages the system resources and provides interface between hardware and software applications.
The Red Hat kernel is a custom-built kernel based on the upstream Linux mainline kernel that Red Hat engineers further develop and harden with a focus on stability and compatibility with the latest technologies and hardware.
Before Red Hat releases a new kernel version, the kernel needs to pass a set of rigorous quality assurance tests.
The Red Hat kernels are packaged in the RPM format so that they are easily upgraded and verified by the DNF package manager.
Kernels that have not been compiled by Red Hat are not supported by Red Hat.
1.2. RPM packages
An RPM package consists of an archive of files and metadata used to install and erase these files. Specifically, the RPM package contains the following parts:
- GPG signature
- The GPG signature is used to verify the integrity of the package.
- Header (package metadata)
- The RPM package manager uses this metadata to determine package dependencies, where to install files, and other information.
- Payload
-
The payload is a
cpio
archive that contains files to install to the system.
There are two types of RPM packages. Both types share the file format and tooling, but have different contents and serve different purposes:
Source RPM (SRPM)
An SRPM contains source code and a
spec
file, which describes how to build the source code into a binary RPM. Optionally, the SRPM can contain patches to source code.- Binary RPM
- A binary RPM contains the binaries built from the sources and patches.
1.3. The Linux kernel RPM package overview
The kernel
RPM is a meta package that does not contain any files, but rather ensures that the following required sub-packages are properly installed:
kernel-core
-
Contains the binary image of the Linux kernel (
vmlinuz
). kernel-modules-core
- Contains the basic kernel modules to ensure core functionality. This includes the modules essential for the proper functioning of the most commonly used hardware.
kernel-modules
-
Contains the remaining kernel modules that are not present in
kernel-core
.
The kernel-core
and kernel-modules-core
sub-packages together can be used in virtualized and cloud environments to provide a RHEL 9 kernel with a quick boot time and a small disk size footprint. kernel-modules
sub-package is usually unnecessary for such deployments.
Optional kernel packages are for example:
kernel-modules-extra
- Contains kernel modules for rare hardware and modules which loading is disabled by default.
kernel-debug
- Contains a kernel with numerous debugging options enabled for kernel diagnosis, at the expense of reduced performance.
kernel-tools
- Contains tools for manipulating the Linux kernel and supporting documentation.
kernel-devel
-
Contains the kernel headers and makefiles sufficient to build modules against the
kernel
package. kernel-abi-stablelists
-
Contains information pertaining to the RHEL kernel ABI, including a list of kernel symbols that are needed by external Linux kernel modules and a
dnf
plug-in to aid enforcement. kernel-headers
- Includes the C header files that specify the interface between the Linux kernel and user-space libraries and programs. The header files define structures and constants that are needed for building most standard programs.
kernel-uki-virt
Contains the Unified Kernel Image (UKI) of the RHEL kernel.
UKI combines the Linux kernel,
initramfs
, and the kernel command line into a single signed binary which can be booted directly from the UEFI firmware.kernel-uki-virt
contains the required kernel modules to run in virtualized and cloud environments and can be used instead of thekernel-core
sub-package.Importantkernel-uki-virt
is provided as Technology Preview in RHEL 9.2.
Additional resources
1.4. Displaying contents of a kernel package
To determine if a kernel package provides a specific file, such as a module, you can display the file list of the package for your architecture by querying the repository. It is not necessary to download or install the package to display the file list.
Use the dnf
utility to query the file list, for example, of the kernel-core
, kernel-modules-core
, or kernel-modules
package. Note that the kernel
package is a meta package that does not contain any files.
Procedure
List the available versions of a package:
$ dnf repoquery <package_name>
For example, list the available versions of the
kernel-core
package:$ dnf repoquery kernel-core kernel-core-0:5.14.0-162.12.1.el9_1.x86_64 kernel-core-0:5.14.0-162.18.1.el9_1.x86_64 kernel-core-0:5.14.0-162.22.2.el9_1.x86_64 kernel-core-0:5.14.0-162.23.1.el9_1.x86_64 ...
Display the list of files in a package:
$ dnf repoquery -l <package_name>
For example, display the list of files in the
kernel-core-0:5.14.0-162.23.1.el9_1.x86_64
package.$ dnf repoquery -l kernel-core-0:5.14.0-162.23.1.el9_1.x86_64 /boot/System.map-5.14.0-162.23.1.el9_1.x86_64 /boot/config-5.14.0-162.23.1.el9_1.x86_64 /boot/initramfs-5.14.0-162.23.1.el9_1.x86_64.img /boot/symvers-5.14.0-162.23.1.el9_1.x86_64.gz /boot/vmlinuz-5.14.0-162.23.1.el9_1.x86_64 /lib/modules /lib/modules/5.14.0-162.23.1.el9_1.x86_64 /lib/modules/5.14.0-162.23.1.el9_1.x86_64/.vmlinuz.hmac /lib/modules/5.14.0-162.23.1.el9_1.x86_64/System.map ...
Additional resources
1.5. Installing specific kernel versions
Install new kernels using the dnf package manager.
Procedure
To install a specific kernel version, enter the following command:
# dnf install kernel-{version}
Additional resources
1.6. Updating the kernel
Update the kernel using the dnf package manager.
Procedure
To update the kernel, enter the following command:
# dnf update kernel
This command updates the kernel along with all dependencies to the latest available version.
- Reboot your system for the changes to take effect.
Additional resources
- package manager
-
The
dnf(8)
manual page
1.7. Setting a kernel as default
Set a specific kernel as default using the grubby
command-line tool and GRUB.
Procedure
Setting the kernel as default, using the
grubby
toolEnter the following command to set the kernel as default using the
grubby
tool:# grubby --set-default $kernel_path
The command uses a machine ID without the
.conf
suffix as an argument.NoteThe machine ID is located in the
/boot/loader/entries/
directory.
Setting the kernel as default, using the
id
argumentList the boot entries using the
id
argument and then set an intended kernel as default:# grubby --info ALL | grep id # grubby --set-default /boot/vmlinuz-<version>.<architecture>
NoteTo list the boot entries using the
title
argument, execute the# grubby --info=ALL | grep title
command.
Setting the default kernel for only the next boot
Execute the following command to set the default kernel for only the next reboot using the
grub2-reboot
command:# grub2-reboot <index|title|id>
WarningSet the default kernel for only the next boot with care. Installing new kernel RPM’s, self-built kernels, and manually adding the entries to the
/boot/loader/entries/
directory may change the index values.