Chapter 1. The Linux kernel
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. Warning Kernels that are not 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 Provides the binary image of the Linux kernel ( vmlinuz ). kernel-modules-core Provides 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 Provides 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 Provides kernel modules for rare hardware. Loading of the module is disabled by default. kernel-debug Provides a kernel with many debugging options enabled for kernel diagnosis, at the expense of reduced performance. kernel-tools Provides tools for manipulating the Linux kernel and supporting documentation. kernel-devel Provides the kernel headers and makefiles that are enough to build modules against the kernel package. kernel-abi-stablelists Provides information pertaining to the RHEL kernel ABI, including a list of kernel symbols required 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 required 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 the kernel-core sub-package. Additional resources What are the kernel-core, kernel-modules, and kernel-modules-extras packages? 1.4. Displaying contents of a kernel package By querying the repository, you can see if a kernel package provides a specific file, such as a module. 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: Display the list of files in a package: Additional resources Packaging and distributing software 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: Additional resources Red Hat Code Browser Red Hat Enterprise Linux Release Dates 1.6. Updating the kernel Update the kernel using the dnf package manager. Procedure To update the kernel, enter the following command: 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 by using the grubby command-line tool and GRUB. Procedure Setting the kernel as default by using the grubby tool. Enter the following command to set the kernel as default using the grubby tool: The command uses a machine ID without the .conf suffix as an argument. Note The machine ID is located in the /boot/loader/entries/ directory. Setting the kernel as default by using the id argument. List the boot entries using the id argument and then set an intended kernel as default: Note To list the boot entries using the title argument, execute the # grubby --info=ALL | grep title command. Setting the default kernel for only the boot. Execute the following command to set the default kernel for only the reboot using the grub2-reboot command: Warning Set the default kernel for only the boot with care. Installing new kernel RPMs, self-built kernels, and manually adding the entries to the /boot/loader/entries/ directory might change the index values.
dnf repoquery <package_name> dnf repoquery -l <package_name> dnf install kernel- {version} dnf update kernel grubby --set-default USDkernel_path grubby --info ALL | grep id grubby --set-default /boot/vmlinuz-<version>.<architecture> grub2-reboot <index|title|id>