Documentation for a newer release is available. View Latest

Manually Upgrading the Kernel

indexterm:[kernel,upgrading the kernel]indexterm:[kernel,package]indexterm:[kernel,RPM package]indexterm:[package,kernel RPM] The Fedora kernel is custom-built by the Fedora kernel team to ensure its integrity and compatibility with supported hardware. Before a kernel is released, it must first pass a rigorous set of quality assurance tests.

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.

Use DNF to install kernels whenever possible

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:

  1. Install the SYSLINUX bootloader on the USB storage device:

    ~]# syslinux /dev/sdX1

    …​where sdX is the device name.

  2. Create mount points for boot.iso and the USB storage device:

    ~]# mkdir /mnt/isoboot /mnt/diskboot
  3. Mount boot.iso:

    ~]# mount -o loop boot.iso /mnt/isoboot
  4. Mount the USB storage device:

    ~]# mount /dev/sdX1 /mnt/diskboot
  5. Copy the ISOLINUX files from the boot.iso to the USB storage device:

    ~]# cp /mnt/isoboot/isolinux/* /mnt/diskboot
  6. Use the isolinux.cfg file from boot.iso as the syslinux.cfg file for the USB device:

    ~]# grep -v local /mnt/isoboot/isolinux/isolinux.cfg > /mnt/diskboot/syslinux.cfg
  7. Unmount boot.iso and the USB storage device:

    ~]# umount /mnt/isoboot /mnt/diskboot
  8. 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:

~]# dnf list installed "kernel-*"
Last metadata expiration check performed 0:28:51 ago on Tue May 26 21:22:39 2015.
Installed Packages
kernel-core.x86_64                      4.0.3-300.fc22                @System
kernel-core.x86_64                      4.0.4-300.fc22                @System
kernel-core.x86_64                      4.0.4-301.fc22                @System
kernel-headers.x86_64                   4.0.4-301.fc22                @System
kernel-modules.x86_64                   4.0.3-300.fc22                @System
kernel-modules.x86_64                   4.0.4-300.fc22                @System
kernel-modules.x86_64                   4.0.4-301.fc22                @System

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 http://bodhi.fedoraproject.org/.

  • Via DNF using check-update:

dnf check-update --enablerepo=updates-testing

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.

Keep the old kernel when performing the upgrade

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:

~]# rpm -ivh kernel-kernel_version.arch.rpm

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:

Verifying the Initial RAM Disk Image
  1. 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:

    Exemple 1. Ensuring that the kernel and initramfs versions match
    ~]# ls /boot/
    config-3.17.4-302.fc21.x86_64
    config-3.17.6-300.fc21.x86_64
    config-3.17.7-300.fc21.x86_64
    efi
    elf-memtest86+-5.01
    extlinux
    grub2
    initramfs-0-rescue-db90b4e3715b42daa871351439343ca4.img
    initramfs-3.17.4-302.fc21.x86_64.img
    initramfs-3.17.6-300.fc21.x86_64.img
    initramfs-3.17.7-300.fc21.x86_64.img
    initrd-plymouth.img
    lost+found
    memtest86+-5.01
    System.map-3.17.4-302.fc21.x86_64
    System.map-3.17.6-300.fc21.x86_64
    System.map-3.17.7-300.fc21.x86_64
    vmlinuz-0-rescue-db90b4e3715b42daa871351439343ca4
    vmlinuz-3.17.4-302.fc21.x86_64
    vmlinuz-3.17.6-300.fc21.x86_64
    vmlinuz-3.17.7-300.fc21.x86_64
    • 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.

      initrd files in the /boot/ directory are not the same as initramfs files

      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.

  2. (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:

    ~]# dracut

    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:

    ~]# dracut
    F: Will not override existing initramfs (/boot/initramfs-3.17.7-300.fc21.x86_64.img) without --force

    You can create an initramfs in the current directory by calling dracut initramfs_name kernel_version, for example:

    ~]# dracut "initramfs-$(uname -r).img" $(uname -r)

    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:

    ~]# lsinitrd /boot/initramfs-3.17.7-300.fc21.x86_64.img
    Image: /boot/initramfs-3.17.7-300.fc21.x86_64.img: 18M
    ========================================================================
    Version: dracut-038-31.git20141204.fc21
    [output truncated]

    See man dracut and man dracut.conf for more information on options and usage.

  3. 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:

    ~]# grep initramfs /boot/grub2/grub.cfg
    	initrd16 /initramfs-3.17.7-300.fc21.x86_64.img
    	initrd16 /initramfs-3.17.6-300.fc21.x86_64.img
    	initrd16 /initramfs-3.17.4-302.fc21.x86_64.img
    	initrd16 /initramfs-0-rescue-db90b4e3715b42daa871351439343ca4.img

    See Verifying the Boot Loader for more information on how to read and update the /boot/grub2/grub.cfg file.

Verifying the Initial RAM Disk Image and Kernel on IBM eServer System i

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:

ls -l /boot/

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.

Tableau 1. Boot loaders by architecture
Architecture Boot Loader See

x86

GRUB 2

Configuring the GRUB 2 Boot Loader

AMD AMD64 or Intel 64

GRUB 2

Configuring the GRUB 2 Boot Loader

IBM eServer System i

OS/400

Configuring the OS/400 Boot Loader

IBM eServer System p

YABOOT

Configuring the YABOOT Boot Loader

IBM System z

z/IPL

Configuring the GRUB 2 Boot Loader

Fedora Rawhide is distributed with GRUB 2, which reads its configuration from the /boot/grub2/grub.cfg file. This file is generated by the grub2-mkconfig utility based on Linux kernels located in the /boot directory, template files located in /etc/grub.d/, and custom settings in the /etc/default/grub file and is automatically updated each time you install a new kernel from an RPM package. To update this configuration file manually, type the following at a shell prompt as root:

grub2-mkconfig -o /boot/grub2/grub.cfg

Among various code snippets and directives, the /boot/grub2/grub.cfg configuration file contains one or more menuentry blocks, each representing a single GRUB 2 boot menu entry. These blocks always start with the menuentry keyword followed by a title, list of options, and opening curly bracket, and end with a closing curly bracket. Anything between the opening and closing bracket should be indented. For example, the following is a sample menuentry block for Fedora 21 with Linux kernel 3.17.6-300.fc21.x86_64:

menuentry 'Fedora (3.17.6-300.fc21.x86_64) 21 (Twenty One)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.17.4-301.fc21.x86_64-advanced-effee860-8d55-4e4a-995e-b4c88f9ac9f0' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  f19c92f4-9ead-4207-b46a-723b7a2c51c8
        else
          search --no-floppy --fs-uuid --set=root f19c92f4-9ead-4207-b46a-723b7a2c51c8
        fi
        linux16 /vmlinuz-3.17.6-300.fc21.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet LANG=en_US.UTF-8
        initrd16 /initramfs-3.17.6-300.fc21.x86_64.img
}

Each menuentry block that represents an installed Linux kernel contains linux and initrd directives followed by the path to the kernel and the initramfs image respectively. If a separate /boot partition was created, the paths to the kernel and the initramfs image are relative to /boot. In the example above, the initrd16 /initramfs-3.17.6-300.fc21.x86_64.img line means that the initramfs image is actually located at /boot/initramfs-3.17.6-300.fc21.x86_64.img when the root file system is mounted, and likewise for the kernel path.

The kernel version number as given on the linux /vmlinuz-kernel_version line must match the version number of the initramfs image given on the initrd /initramfs-kernel_version.img line of each menuentry block. For more information on how to verify the initial RAM disk image, refer to Verifying the Initial RAM Disk Image.

The initrd directive in grub.cfg refers to an initramfs image

In menuentry blocks, the initrd directive must point to the location (relative to the /boot directory if it is on a separate partition) of the initramfs file corresponding to the same kernel version. This directive is called initrd because the previous tool which created initial RAM disk images, mkinitrd, created what were known as initrd files. The grub.cfg directive remains initrd to maintain compatibility with other tools. The file-naming convention of systems using the dracut utility to create the initial RAM disk image is initramfs-kernel_version.img.

For information on using Dracut, refer to Verifying the Initial RAM Disk Image.

After installing a new kernel with rpm, verify that /boot/grub2/grub.cfg is correct and reboot the computer into the new kernel. Ensure your hardware is detected by watching the boot process output. If GRUB 2 presents an error and is unable to boot into the new kernel, it is often easiest to try to boot into an alternative or older kernel so that you can fix the problem. Alternatively, use the boot media you created earlier to boot the system.

Causing the GRUB 2 boot menu to display

If you set the GRUB_TIMEOUT option in the /etc/default/grub file to 0, GRUB 2 will not display its list of bootable kernels when the system starts up. In order to display this list when booting, press and hold any alphanumeric key while and immediately after BIOS information is displayed, and GRUB 2 will present you with the GRUB menu.

Configuring the OS/400 Boot Loader

The /boot/vmlinitrd-kernel-version file is installed when you upgrade the kernel. However, you must use the dd command to configure the system to boot the new kernel.

  1. As root, issue the command cat /proc/iSeries/mf/side to determine the default side (either A, B, or C).

  2. As root, issue the following command, where kernel-version is the version of the new kernel and side is the side from the previous command:

    dd if=/boot/vmlinitrd-kernel-version of=/proc/iSeries/mf/side/vmlinux bs=8k

Begin testing the new kernel by rebooting the computer and watching the messages to ensure that the hardware is detected properly.

Configuring the YABOOT Boot Loader

IBM eServer System p uses YABOOT as its boot loader. YABOOT uses /etc/aboot.conf as its configuration file. Confirm that the file contains an image section with the same version as the kernel package just installed, and likewise for the initramfs image:

boot=/dev/sda1 init-message=Welcome to Fedora! Hit <TAB> for boot options
partition=2 timeout=30 install=/usr/lib/yaboot/yaboot delay=10 nonvram
image=/vmlinuz-2.6.32-17.EL
	 label=old
	 read-only
	 initrd=/initramfs-2.6.32-17.EL.img
	 append="root=LABEL=/"
image=/vmlinuz-2.6.32-19.EL
	 label=linux
	 read-only
	 initrd=/initramfs-2.6.32-19.EL.img
	 append="root=LABEL=/"

Notice that the default is not set to the new kernel. The kernel in the first image is booted by default. To change the default kernel to boot either move its image stanza so that it is the first one listed or add the directive default and set it to the label of the image stanza that contains the new kernel.

Begin testing the new kernel by rebooting the computer and watching the messages to ensure that the hardware is detected properly.