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 YUM 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 kernel, all
initramfs
-related objects to bootstrap the system, and a minimal number of kernel modules to ensure core functionality. This sub-package alone could be used in virtualized and cloud environments to provide a Red Hat Enterprise Linux 8 kernel with a quick boot time and a small disk size footprint. kernel-modules
-
Contains the remaining kernel modules that are not present in
kernel-core
.
The small set of kernel
sub-packages above aims to provide a reduced maintenance surface to system administrators especially in virtualized and cloud environments.
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
yum
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.
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:
$ yum repoquery <package_name>
For example, list the available versions of the
kernel-core
package:$ yum repoquery kernel-core kernel-core-0:4.18.0-147.0.2.el8_1.x86_64 kernel-core-0:4.18.0-147.0.3.el8_1.x86_64 kernel-core-0:4.18.0-147.3.1.el8_1.x86_64 kernel-core-0:4.18.0-147.5.1.el8_1.x86_64 kernel-core-0:4.18.0-147.8.1.el8_1.x86_64 kernel-core-0:4.18.0-147.el8.x86_64 …
Display the list of files in a package:
$ yum 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.$ yum repoquery -l kernel-core-0:4.18.0-147.8.1.el8_1.x86_64 /boot/.vmlinuz-4.18.0-147.8.1.el8_1.x86_64.hmac /boot/System.map-4.18.0-147.8.1.el8_1.x86_64 /boot/config-4.18.0-147.8.1.el8_1.x86_64 /boot/initramfs-4.18.0-147.8.1.el8_1.x86_64.img /boot/symvers-4.18.0-147.8.1.el8_1.x86_64.gz /boot/vmlinuz-4.18.0-147.8.1.el8_1.x86_64 /etc/ld.so.conf.d/kernel-4.18.0-147.8.1.el8_1.x86_64.conf /lib/modules /lib/modules/4.18.0-147.8.1.el8_1.x86_64 ...
Additional resources
1.5. Installing specific kernel versions
Install new kernels using the yum package manager.
Procedure
To install a specific kernel version, enter the following command:
# yum install kernel-{version}
Additional resources
1.6. Updating the kernel
Update the kernel using the yum package manager.
Procedure
To update the kernel, enter the following command:
# yum 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.
When upgrading from RHEL 7 to RHEL 8, follow relevant sections of the Upgrading from RHEL 7 to RHEL 8 document.
Additional resources
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.