Manually Upgrading the Kernel
Fedora kernels are packaged in the RPM format so that they are easy to upgrade and verify using the DNF or PackageKit package managers. PackageKit automatically queries the DNF repositories and informs you of packages with available updates, including kernel packages.
This chapter is therefore only useful for users who need to manually update a kernel package using the rpm command instead of dnf .
Whenever possible, use either the DNF or PackageKit package manager to install a new kernel because they always install a new kernel instead of replacing the current one, which could potentially leave your system unable to boot.
For more information on installing kernel packages with DNF, see Updating Packages.
Overview of Kernel Packages
Fedora contains the following kernel packages:
kernel — Contains the kernel for single, multicore and multiprocessor systems.
kernel-debug — Contains a kernel with numerous debugging options enabled for kernel diagnosis, at the expense of reduced performance.
kernel-devel — Contains the kernel headers and makefiles sufficient to build modules against the kernel package.
kernel-debug-devel — Contains the development version of the kernel with numerous debugging options enabled for kernel diagnosis, at the expense of reduced performance.
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.
linux-firmware — Contains all of the firmware files that are required by various devices to operate.
perf — This package contains supporting scripts and documentation for the perf tool shipped in each kernel image subpackage.
kernel-abi-whitelists — Contains information pertaining to the Fedora kernel ABI, including a lists of kernel symbols that are needed by external Linux kernel modules and a dnf plug-in to aid enforcement.
kernel-tools — Contains tools for manipulating the Linux kernel and supporting documentation.
Preparing to Upgrade
Before upgrading the kernel, it is recommended that you take some precautionary steps.
First, ensure that working boot media exists for the system in case a problem occurs. If the boot loader is not configured properly to boot the new kernel, you can use this media to boot into Fedora.
USB media often comes in the form of flash devices sometimes called pen drives, thumb disks, or keys, or as an externally-connected hard disk device. Almost all media of this type is formatted as a VFAT file system. You can create bootable USB media on media formatted as ext2 , ext3 , ext4 , or VFAT .
You can transfer a distribution image file or a minimal boot media image file to USB media. Make sure that sufficient free space is available on the device. Around 4В GB is required for a distribution DVD image, around 700В MB for a distribution CD image, or around 10В MB for a minimal boot media image.
You must have a copy of the boot.iso file from a Fedora installation DVD, or installation CD-ROM#1, and you need a USB storage device formatted with the VFAT file system and around 16 MB of free space. The following procedure will not affect existing files on the USB storage device unless they have the same path names as the files that you copy onto it. To create USB boot media, perform the following commands as the root user:
Install the SYSLINUX bootloader on the USB storage device:
…where sdX is the device name.
Create mount points for boot.iso and the USB storage device:
Mount the USB storage device:
Copy the ISOLINUX files from the boot.iso to the USB storage device:
Use the isolinux.cfg file from boot.iso as the syslinux.cfg file for the USB device:
Unmount boot.iso and the USB storage device:
You should reboot the machine with the boot media and verify that you are able to boot with it before continuing.
Alternatively, on systems with a floppy drive, you can create a boot diskette by installing the mkbootdisk package and running the mkbootdisk command as root . See man mkbootdisk man page after installing the package for usage information.
To determine which kernel packages are installed, execute the command dnf list installed «kernel-*» at a shell prompt. The output will comprise some or all of the following packages, depending on the system’s architecture, and the version numbers might differ:
From the output, determine which packages need to be downloaded for the kernel upgrade. For a single processor system, the only required package is the kernel package. See Overview of Kernel Packages for descriptions of the different packages.
Downloading the Upgraded Kernel
There are several ways to determine if an updated kernel is available for the system.
Via Fedora Update System — Download and install the kernel RPM packages. For more information, refer to https://bodhi.fedoraproject.org/.
Via DNF using check-update:
To install the kernel manually, continue to Performing the Upgrade.
Performing the Upgrade
After retrieving all of the necessary packages, it is time to upgrade the existing kernel.
It is strongly recommended that you keep the old kernel in case there are problems with the new kernel.
At a shell prompt, change to the directory that contains the kernel RPM packages. Use -i argument with the rpm command to keep the old kernel. Do not use the -U option, since it overwrites the currently installed kernel, which creates boot loader problems. For example:
The next step is to verify that the initial RAM disk image has been created. See Verifying the Initial RAM Disk Image for details.
Verifying the Initial RAM Disk Image
The job of the initial RAM disk image is to preload the block device modules, such as for IDE, SCSI or RAID, so that the root file system, on which those modules normally reside, can then be accessed and mounted. On Fedora Rawhide systems, whenever a new kernel is installed using either the DNF, PackageKit, or RPM package manager, the Dracut utility is always called by the installation scripts to create an initramfs (initial RAM disk image).
On all architectures other than IBMВ eServerВ SystemВ i (see Verifying the Initial RAM Disk Image and Kernel on IBM eServer System i), you can create an initramfs by running the dracut command. However, you usually don’t need to create an initramfs manually: this step is automatically performed if the kernel and its associated packages are installed or upgraded from RPM packages distributed by The Fedora Project.
On architectures that use the GRUB 2 boot loader, you can verify that an initramfs corresponding to your current kernel version exists and is specified correctly in the /boot/grub2/grub.cfg configuration file by following this procedure:
As root , list the contents in the /boot/ directory and find the kernel ( vmlinuz-kernel_version ) and initramfs-kernel_version with the latest (most recent) version number:
we have three kernels installed (or, more correctly, three kernel files are present in the /boot/ directory),
the latest kernel is vmlinuz-3.17.7-300.fc21.x86_64 , and
an initramfs file matching our kernel version, initramfs-3.17.7-300.fc21.x86_64.img , also exists.
In the /boot/ directory you might find several initrd-kernel_versionkdump.img files. These are special files created by the kdump mechanism for kernel debugging purposes, are not used to boot the system, and can safely be ignored. For more information on kdump , see the Red Hat Enterprise Linux 7 Kernel Crash Dump Guide.
(Optional) If your initramfs-kernel_version file does not match the version of the latest kernel in /boot , or, in certain other situations, you might need to generate an initramfs file with the Dracut utility. Simply invoking dracut as root without options causes it to generate an initramfs file in the /boot/ directory for the latest kernel present in that directory:
You must use the —force option if you want dracut to overwrite an existing initramfs (for example, if your initramfs has become corrupt). Otherwise dracut will refuse to overwrite the existing initramfs file:
You can create an initramfs in the current directory by calling dracut initramfs_name kernel_version , for example:
If you need to specify specific kernel modules to be preloaded, add the names of those modules (minus any file name suffixes such as .ko ) inside the parentheses of the add_dracutmodules=»module more_modules» directive of the /etc/dracut.conf configuration file. You can list the file contents of an initramfs image file created by dracut by using the lsinitrd initramfs_file command:
See man dracut and man dracut.conf for more information on options and usage.
Examine the /boot/grub2/grub.cfg configuration file to ensure that an initramfs-kernel_version.img file exists for the kernel version you are booting. For example:
See Verifying the Boot Loader for more information on how to read and update the /boot/grub2/grub.cfg file.
On IBM eServer System i machines, the initial RAM disk and kernel files are combined into a single file, which is created with the addRamDisk command. This step is performed automatically if the kernel and its associated packages are installed or upgraded from the RPM packages distributed by The Fedora Project; thus, it does not need to be executed manually. To verify that it was created, run the following command as root to make sure the /boot/vmlinitrd-kernel_version file already exists:
The kernel_version should match the version of the kernel just installed.
Verifying the Boot Loader
When you install a kernel using rpm , the kernel package creates an entry in the boot loader configuration file for that new kernel. However, rpm does not configure the new kernel to boot as the default kernel. You must do this manually when installing a new kernel with rpm .
It is always recommended to double-check the boot loader configuration file after installing a new kernel with rpm to ensure that the configuration is correct. Otherwise, the system might not be able to boot into Fedora properly. If this happens, boot the system with the boot media created earlier and re-configure the boot loader.
In the following table, find your system’s architecture to determine the boot loader it uses, and then click on the “See” link to jump to the correct instructions for your system.
Architecture | Boot Loader | See |
---|---|---|