Fedora

How to Check Version and Update Fedora Linux Kernel

For any operating system, the kernel is at the core. Linux is the kernel, rather than the entire operating system, of any Linux distribution. The kernel is responsible for interacting between the hardware of the computer and the software.

The Linux kernel is regularly updated to offer the best possible experience. This guide shows you how to check the version and update the kernel of Fedora.

Fedora Linux

Fedora is a well-known Linux distribution that is free for all users. This is the distribution that comprises the base of the Red Hat Enterprise Linux. While Fedora is primarily sponsored by Red Hat, thousands of other developers contribute to the project that was eventually incorporated into RHEL (after testing and quality assurance processes).

Basically, Fedora is the upstream, community distribution of RHEL. However, Fedora is also a solid distribution for general use, workstations, servers, containers, and others.

Check Fedora Linux Kernel Version

Checking the current kernel version will determine whether there is an update available.

There are multiple tools available to check the current version of the kernel.

uname

The uname command is a powerful tool for printing system information, including information about the kernel. There are two parameters to reveal kernel information.

The following command will print the kernel version of the running kernel.

$ uname -r

The kernel version can be broken into the following format.

$ <major_version>-<minor_version>-<release>.<architecture>

To check the kernel release time, use the following command.

$ uname -v

neofetch

The neofetch tool is similar to uname. It is also a lightweight tool used for revealing system information. The reason I like neofetch is because of its clean and colorized output.

Neofetch is not a tool that comes pre-installed on Fedora. Thankfully, neofetch is directly available from the Fedora software repo. Install neofetch using the dnf command.

$ sudo dnf install neofetch

Launch neofetch. The kernel version is located under the “Kernel” entry.

rpm

The primary job of the rpm tool is to install and manage RPM packages. Fedora installs kernels as RPM packages. Thanks to this, we can use rpm to list all the installed kernel versions.

$ rpm -q kernel

hostnamectl

The hostnamectl command is a tool used for managing the hostname of the system. However, the hostnamectl command can also print system information, including the kernel.

Run the hostnamectl command to report a summary of system information, along with the kernel version.

$ hostnamectl

grubby

The grubby command is a tool used for configuring bootloader menu entries. However, the grubby command can also be used to display the kernel version.

Run the following grubby command to print the location of the default kernel that loaded during boot.

$ sudo grubby --default-kernel

To get further in-depth information about the kernel, use the –info flag followed by the kernel location.

$ grubby --info <kernel>

/proc/version

The content in this file describes system information. It also contains information about the kernel version.

$ cat /proc/version

Updating Fedora Linux Kernel

Fedora manages all system package updates via the DNF package manager. In the case of the kernel, it is no different. It is strongly recommended to update the kernel through DNF.

Update Kernel through System Update

The best way to update the kernel of your system is to run a system update. DNF will search for any available updates for all installed packages (including the kernel) and update to the latest version (if available). To update all installed packages, run the following DNF command.

$ sudo dnf update

Update Kernel Only

It is also possible to update the kernel only. In Fedora, the kernel is managed under the package name kernel. Note that it features only the latest stable kernel. Check out the Linux Kernel Archives for all the available kernel packages.

Before performing the update, check out the kernel package information via the following command.

$ dnf info kernel

There are also other kernel packages offered by Fedora. Here is a quick list of the package names and what they contain. These packages may be relevant in various scenarios; for example, debugging, building kernel modules, etc.

  • kernel: The default package that contains the kernel for single, multi-core, and multi-processor systems.
  • kernel-debug: Contains a kernel with numerous debugging options enabled; great for debugging but comes at the cost of system performance.
  • kernel-devel: Contains kernel headers and makefiles to build modules against the kernel package.
  • kernel-debug-devel: The development version of the kernel that comes with numerous debugging options enabled; suitable for debugging but comes at the cost of system performance.
  • kernel-headers: Contains the C header files that specify the interface between the Linux kernel and user-space libraries and apps. These header files define various structures and constants that are crucial for building most standard programs.
  • linux-firmware: Contains all the Linux firmware files necessary to run various devices.
    perf: Contains necessary scripts and documentation of the ‘perf’ tool that comes with each kernel image sub-package.
  • kernel-abi-whitelists: Contains information related to the Fedora kernel ABI; includes a list of kernel symbols that are necessary by external Linux kernel modules and contains a DNF plugin to enforce the rule.
  • kernel-tools: Contains various tools and documentation for manipulating the Linux kernel.

To update to the latest kernel, run the following DNF command, which automatically installs the most suitable kernel version for your system.

$ sudo dnf install kernel --best

To take the changes into effect, reboot the system. Otherwise, your system will continue running on the older kernel.

$ sudo reboot

Configuring the Default Kernel

If multiple versions of the kernel are installed, then one kernel will become the default version that is loaded when the system boots. It is also possible to configure an alternate version of the kernel to be used as the default kernel.

The following command will print the default kernel.

$ sudo grubby --default-kernel

Next, issue the following command to list all the installed kernels, which will also print all the GRUB menu entries for all the kernels.

$ sudo grubby --info=ALL

To set a different kernel as the default kernel, take a note of the kernel location from the previous step and apply this location in the following command. In this case, I have set /boot/vmlinuz-5.8.15-301.fc33.x86_64 as the default kernel, instead of /boot/vmlinuz-5.9.16-200.fc33.x86_64.

$ sudo grubby --set-default <kernel>

Reboot the system to take the changes into effect.

Final Thoughts

Updating the kernel is no longer a difficult task. By default, Fedora offers a pre-compiled kernel that is general-purpose and suitable for the most part.

It is possible to manually build the Linux kernel from source. However, this can be quite a tedious process and takes some time to perform. In certain situations, building and deploying a custom kernel may offer advantages over using the default kernel. Learn more about how to compile a Linux kernel here.

Happy computing!

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.