A Linux kernel is the primary interface between the PC’s hardware and its processes. It works as a channel for communication between the two, managing resources as effectively as feasible.
Just comprehend the kernel to be like a seed inside a hard shell because it exists within the operating system and takes charge of all the major functionalities of the hardware, whether it is a server, phone, laptop, or any other kind of computer. The kernel performs four tasks: memory management, which monitors the amount of memory being used to store what and where; device drivers, which act as an interpreter between processes and hardware; process management, which chooses which processes can use the CPU when and for how long; and, finally, system calls and security, which receives requests for service from the processes.
The kernel operates in a separate environment known as kernel space, where it manages memory allocation and maintains track of where everything is stored while remaining invisible to users. The user space is everything the user can view or interact with, such as files and web browsers. These apps communicate with the kernel through an (SCI)system call interface.
Think about the entire thing this way: The kernel is a busy personal assistant(PA) for a powerful executive (the hardware). It’s the assistant’s mandate to relay requests (processes) and messages from the public (users) and the employees to the executive, to recall what is stored where (memory), and to decide who has access to the executive at any given time and for how long.
Fedora is a popular Linux distribution that is free for all users. It comprises the base of the Red Hat Enterprise Linux. Red Hat is the chief sponsor of Fedora, but many other DevOps worked on the project before it was included in RHEL (after testing and quality processes).
Fedora is essentially RHEL’s upstream community distribution. It is still excellent for general usage, servers, workstations, containers, and other applications.
With that said, let us kickstart the article by checking Fedora’s kernel version.
Check the Fedora Linux kernel version
Checking the current kernel version will give us the go-ahead on whether or not there is an update.
Several tools are at your disposal to check the current version of the kernel.
The uname command line tool is frequently used to find out the architecture of the system’s processors, the kernel version, and the system hostname. There are two parameters concatenated together to reveal kernel information.
The current kernel’s version can be printed out using the following command:
The kernel version can be broken down into the following format:
You can issue the following command if you want to confirm the kernel release time:
Neofetch is a very convenient command line tool to retrieve system information within a split second. It is open-source, cross-platform, and displays anything and everything ranging from your system’s uptime to the kernel version. Neofetch is also lightweight, and the reason most people prefer neofetch is because of its clean and colorized output.
Remember, Neofetch does not come pre-installed on Fedora. That means we have to set it up manually, but interestingly enough, neofetch is directly available from the Fedora software repo. To set up neofetch on Fedora, run the following command:
sudo dnf install neofetch
Then launch neofetch. The kernel version is located under the “kernel” entry, as shown below:
The Red-hat Package Manager (RPM) is an open-source application for installing, uninstalling, and managing software packages in Linux. It consists of an archive of metadata and files, including info like dependencies and setup location. Fedora installs kernels as RPM packages. Thanks to this, we can utilize rpm to list all the setup kernel versions.
To try this out, run the following command:
rpm -q kernel
Grubby is a command line tool for displaying and updating info about configuration files for the grub, zipl, elilo, yaboot, and lilo boot orders. It is primarily intended to be used from scripts that install new kernels and need to retrieve info about the current boot environment.
To print the location of the default kernel that loaded during boot, execute the following command on your terminal:
sudo grubby --default-kernel
To further get in-depth info about the kernel, use the -info flag followed by the kernel location. This follows the following syntax:
grubby --info <kernel>
The info in this file describes system data. It also has information about the kernel version.
With that covered, let us see how to update the Fedora Linux kernel
How to update the Fedora Linux kernel
Fedora manages all system packages through the DNF package manager. In the instance of the kernel, it is barely different. It is highly suggested to update the kernel via DNF.
Update kernel via system update
One of the best approaches to updating your system’s kernel is to run a system update. DNF will scout for any available updates for all the already setup packages, the kernel inclusive, and update to the latest release or version (if available). To update all set-up packages, issue the following DNF command:
sudo dnf update
Let’s see how we can solely update the kernel alone.
How to update the kernel alone
It is not ruled out that you can specifically update the kernel only instead of including a bunch of less important packages. In Fedora, the kernel is managed under the package name kernel. Remember that it features only the latest stable kernel. For all the available kernel packages, check out the Linux kernel Archives.
But before you proceed with performing the update, first check out the kernel package info by issuing the following command on your terminal:
dnf info kernel
Also, there are other kernel packages offered by Fedora. Below is a quick list of the package names and what they contain or possess. These packages may be relevant in various instances, building kernel modules, debugging, and more.
- Kernel – The default package with the kernel for single, multi-core, and multi-processor systems.
- Kernel devel – Has the kernel headers and makefiles to build modules against the kernel package.
- Kernel headers – This has the C header files that designate the interface between the Linux kernel and user-space apps and libraries. These headers define several structures and are crucial for building most standard programs.
- Kernel tools – Has several tools and documentation for manipulating the Linux kernel.
- Kernel debug – Has a kernel with several debugging options enabled; this is great for debugging but ships at the cost of the system’s performance.
- Linux firmware – has all the Linux firmware files required to run several devices.
Perf: Has the required scripts and documentation of the “perf” tool with each image sub-package.
- Kernel debug level – This is the development version of the kernel that ships with multiple debugging options enabled; suitable for debugging but comes at the cost of the system performance.
- Kernel abi whitelists – Has info linked to the Fedora kernel ABI; comprises a list of kernel symbols that are required by external Linux kernel modules and has a DNF plugin to enforce the rule.
To update your Fedora install to the latest kernel, issue the following DNF command, which will spontaneously set up the most suitable kernel version of your system:
sudo dnf install kernel --best
You have to reboot your system for the above changes to take effect. Otherwise, you will continue running on the older version of the kernel. This can be done by simply executing the following command on the terminal:
Let us now configure the default kernel.
How to configure the default kernel
If you have several versions of the kernel installed, then one of the listed kernels in the system will become the default version that will be loaded when the system boots. It is also achievable to configure an alternate kernel version to be utilized as the default kernel.
To do this, run the following command to print the default kernel:
sudo grubby --default-kernel
Then issue the following command to list all the set-up 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 note of the kernel location from the previous step and apply this location in the subsequent command. In this event, we have set “/boot/vmlinuz-6.0.11-200.fc36.x86_64” as the default kernel instead of “/boot/vmlinuz-5.8.17-300.fc36.x86_64”
sudo grubby --set-default <kernel>
Once that is done, restart the system for the changes to take effect.
How to install the latest Linux kernel in Fedora
Fedora also has Kernel Vanilla Repositories for the latest kernel packages. Fedora’s website refers to that repositories, albeit contributors maintain them.
With them, you can get subsequent kernel series for arm64 and amd64 CPU architectures:
- Kernel-vanilla-fedora – The latest point release of Fedora’s default Kernel series.
- Kernel-vanilla-mainline – The latest kernel in the pre-release stage (known as “rc kernel”).
- Kernel-vanilla-stable-RC – Same as the kernel vanilla stable, but also includes the RC kernels.
- Kernel-vanilla-stable – latest stable kernel according to kernel.org
- Kernel-vanilla-mainline-wo-mergew – akin to kernel-vanilla-mainline, but excludes kernels from merge window.
To install this, open your terminal from the start menu or “Activities” overview:
When your terminal is up and running, issue the command to setup the repo:
curl -s https://repos.fedorapeople.org/repos/thl/kernel-vanilla.repo | sudo tee /etc/yum.repos.d/kernel-vanilla.repo
In the end, install the latest kernel via this command:
sudo dnf --enablerepo=kernel-vanilla-stable update
Note: Ensure you replace “kernel-vanilla-stable” with a previous list item, depending on which kernel series you intend to install.
After installation, reboot your PC and enjoy, guys!
Before we wind up the article, let us see how we can uninstall kernel packages if you want to uninstall some.
How to uninstall the kernel packages
To remove kernel packages from the vanilla repository, you can run the following command :
sudo dnf remove $(rpm -qa 'kernel*' | grep '.vanilla' )
To proceed with the removal process, ensure you type “y” in the “Is this Ok [y/N”] question as highlighted above, then hit the “Enter” button on your keyboard to proceed.
As covered above, updating the kernel is no longer a challenging task. By default, Fedora offers a pre-compiled kernel that is general-purpose and suitable for the most part.
There is also a possibility of manually updating the Linux kernel from the source. Nevertheless, this can be a tiresome process to carry out., but from the covered steps, we hope your queries are answered. That is all from our end; we believe this guide was informative enough.