Most times, an updated kernel can make a system more stable by including updates and fixes to previous kernel builds.
For some, you may have software or device drivers that work, or are part of your kernel, only with specific kernels, but usually this is not the case.
So, to help improve stability and possibly performance, you should regularly check for updates to your kernel.
In this article, I will go over installing a newer kernel, if it exists, for the following distros:
To check the current version of your existing kernel, you can use the following command on all distros:
The output will be the kernel version that is currently running. The output will not include other kernels that are installed, but not running.
The output, for example, on Ubuntu would be like:
Ubuntu
The first time you manually want to check for an update, you will need to do the following steps to install the app 'mainline'.
Once you install the program, you only need to perform the following steps to perform a kernel update. Open the program 'Mainline Kernels'.
Once opened, you can see the list of kernels. The list should also show the installed kernels, whether they are currently running or not.
Find the kernel you want to install, select it and then click on the 'Install' button.
After you have installed all the kernels you wish to install, you can reboot so the kernel runs and you can test it. If a kernel does not work for you, you can use your boot loader to select a different kernel version at boot.
From within 'Mainline Kernels', you can also select any installed kernels and click on 'Uninstall' to remove the kernel version.
There is also a button labeled 'Uninstall Old' to remove the older kernels all at once.
CentOS
I used CentOS Stream 9, but the instructions will work for other versions; you just need to know your CentOS version. To get the version you have of either CentOS or Fedora, use the command that matches your distro:
Use the 'uname -r' command to see your current Kernel Version. For example, my CentOS currently has the '5.14.0-599.el9.x86_64' kernel.
Before we install the packages, we need to set up keys for verification:
NOTE: If you get a 404 error, then the address may be incorrect.
Now that we have the keys, we can install the package. This command depends on the version of the distro:
NOTE: Be sure to replace the '#' signs with the version of your distro, such as '9' or even '10'. For example, if you have CentOS 9, then the command is 'sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm'.
Once you complete these steps, you only need to run the last step each time you want to update the kernel.
At any time, you can check the current version available with the following command:
The resulting list should show the available versions in the second column, as shown in Figure 1.
FIGURE 1
The output shows the mainline kernels, but if you change 'kernel-ml' to 'kernel-lt', you'll get the listing of the long-term support kernel. If you want the lt' version, then just change the install command from 'ml' to 'lt'.
For a business, stick to the long-term version which are supported and stable. The main-line kernels may have more hardware support for newer hardware, but Red Hat does not support them. The main-line kernels have updates available more often, but may not be as stable as the long-term version.
This command will update the kernel to the newest mainline (ml) version. If you issue the command at any time, it can update the kernel if a newer one exists. If there is no newer kernel, then you get a message that the kernel is already up-to-date.
If you have a boot loader, such as GRUB, you need to update it if it does not perform auto-updates when you install new kernels. For example, you can use the command:
Use the command you need for your specific boot loader.
After rebooting, I can use the 'uname -r' command and my kernel is now '6.16.4-1.el9.elrepo.x86_64'.
Fedora
Even though CentOS and Fedora are both based on Red Hat, the kernel updates are different on the two systems.
As usual, you need to see what kernel version you are starting with before continuing, so use 'uname -r'.
My kernel version is '6.16.4-100.fc41.x86_64'.
To start the kernel update, you need to stay in the terminal and perform the following two commands:
The first command adds a repository, and the second command updates the local repository lists from the existing repositories and the newly added one.
With the second command, if it prompts you to update files, then answer yes (y), as requested.
You can update your boot loader menu, such as GRUB, if needed, and reboot.
After rebooting, my kernel was '6.17.0-0.rc3.250831.c8bc81a5.134.vanilla.fc41.x86_64'.
When you perform any updates, they should update your kernel if a newer one exists.
The 'vanilla' kernels are close to those being released and do not have any Fedora modifications; which are patches, security modifications and optimizations made on them.
If you want the mainline Fedora kernel, when you do a system update it will be part of it, if a new kernel version exists.
The command to perform the update is:
Arch
When updating the Arch system, it should automatically update the kernel.
To perform an update, for all system files and the kernel, use the command:
After performing an update, you may need to update your boot loader before rebooting the system.
If you do not want the main-line kernel, then you can install a vanilla version, as we have covered the vanilla version above.
To do this, you need an AUR helper, such as 'yay'. For this, do the following after you update your packages from the repositories:
If the system prompts you about installing dependencies or the like, just accept the defaults.
The installation of the AUR helper may take a while to complete. Once it is complete, you can run 'yay' to update its repository lists.
To install the kernel, use the command:
You can also install the long-term (lts) with the command:
You can get a listing of the latest kernel version with one of the following commands, depending on which type you prefer:
For example, my current system is running version '6.16.4-arch1-1'. For the mainline version, I can install version '6.17rc4-1' and for the LTS version '6.12.44-1'.
The first time you run this command, there will be a lot of dependencies installed and keys imported. Keep close during the initial install since it will ask a lot for you to verify various steps.
The kernel install will take more time since the system compiles the kernel from source code.
If you have your 'initramfs' on a separate partition, you may need to build it yourself. Also, update the boot loader for the new kernel.
Checking the Kernel
After rebooting, you need to check the basic functionality of the system. Make sure all the hardware is working, such as:
Another trick is that if there are boot issues, try a second time, just in case.
A good choice is to have a boot loader like GRUB that allows you to select a different kernel version if the current one has issues.
Conclusion
Some users like to keep their systems updated to the most current version of all the apps. Sometimes this includes the kernel.
With these instructions, you can keep your system up to date with a mainline or long-term-support kernel, depending on your preference and system use.
If you need a very stable version, you may stick to the version that is downloaded during a normal update, or even the LTS version.
For some, you may have software or device drivers that work, or are part of your kernel, only with specific kernels, but usually this is not the case.
So, to help improve stability and possibly performance, you should regularly check for updates to your kernel.
In this article, I will go over installing a newer kernel, if it exists, for the following distros:
- Ubuntu
- CentOS
- Fedora
- Arch
To check the current version of your existing kernel, you can use the following command on all distros:
Code:
uname -r
The output will be the kernel version that is currently running. The output will not include other kernels that are installed, but not running.
The output, for example, on Ubuntu would be like:
Code:
6.14.0-29-generic
Ubuntu
The first time you manually want to check for an update, you will need to do the following steps to install the app 'mainline'.
Code:
sudo add-apt-repository ppa:cappelikan/ppa
sudo apt install mainline -y
Once you install the program, you only need to perform the following steps to perform a kernel update. Open the program 'Mainline Kernels'.
Once opened, you can see the list of kernels. The list should also show the installed kernels, whether they are currently running or not.
Find the kernel you want to install, select it and then click on the 'Install' button.
After you have installed all the kernels you wish to install, you can reboot so the kernel runs and you can test it. If a kernel does not work for you, you can use your boot loader to select a different kernel version at boot.
From within 'Mainline Kernels', you can also select any installed kernels and click on 'Uninstall' to remove the kernel version.
There is also a button labeled 'Uninstall Old' to remove the older kernels all at once.
CentOS
I used CentOS Stream 9, but the instructions will work for other versions; you just need to know your CentOS version. To get the version you have of either CentOS or Fedora, use the command that matches your distro:
Code:
cat /etc/centos-release
cat /etc/fedora-release
Use the 'uname -r' command to see your current Kernel Version. For example, my CentOS currently has the '5.14.0-599.el9.x86_64' kernel.
Before we install the packages, we need to set up keys for verification:
Code:
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-v2-elrepo.org
NOTE: If you get a 404 error, then the address may be incorrect.
Now that we have the keys, we can install the package. This command depends on the version of the distro:
Code:
sudo dnf install https://www.elrepo.org/elrepo-release-#.el#.elrepo.noarch.rpm
NOTE: Be sure to replace the '#' signs with the version of your distro, such as '9' or even '10'. For example, if you have CentOS 9, then the command is 'sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm'.
Once you complete these steps, you only need to run the last step each time you want to update the kernel.
Code:
sudo dnf --enablerepo=elrepo-kernel install kernel-ml
At any time, you can check the current version available with the following command:
Code:
sudo yum list available --disablerepo='*' --enablerepo=elrepo-kernel kernel-ml*
The resulting list should show the available versions in the second column, as shown in Figure 1.
FIGURE 1
The output shows the mainline kernels, but if you change 'kernel-ml' to 'kernel-lt', you'll get the listing of the long-term support kernel. If you want the lt' version, then just change the install command from 'ml' to 'lt'.
For a business, stick to the long-term version which are supported and stable. The main-line kernels may have more hardware support for newer hardware, but Red Hat does not support them. The main-line kernels have updates available more often, but may not be as stable as the long-term version.
This command will update the kernel to the newest mainline (ml) version. If you issue the command at any time, it can update the kernel if a newer one exists. If there is no newer kernel, then you get a message that the kernel is already up-to-date.
If you have a boot loader, such as GRUB, you need to update it if it does not perform auto-updates when you install new kernels. For example, you can use the command:
Code:
sudo grub2.mkconfig -o /boot/efi/EFI/centos/grub.cfg
Use the command you need for your specific boot loader.
After rebooting, I can use the 'uname -r' command and my kernel is now '6.16.4-1.el9.elrepo.x86_64'.
Fedora
Even though CentOS and Fedora are both based on Red Hat, the kernel updates are different on the two systems.
As usual, you need to see what kernel version you are starting with before continuing, so use 'uname -r'.
My kernel version is '6.16.4-100.fc41.x86_64'.
To start the kernel update, you need to stay in the terminal and perform the following two commands:
Code:
sudo dnf -y copr enable @kernel-vanilla/mainline
sudo dnf update
The first command adds a repository, and the second command updates the local repository lists from the existing repositories and the newly added one.
With the second command, if it prompts you to update files, then answer yes (y), as requested.
You can update your boot loader menu, such as GRUB, if needed, and reboot.
After rebooting, my kernel was '6.17.0-0.rc3.250831.c8bc81a5.134.vanilla.fc41.x86_64'.
When you perform any updates, they should update your kernel if a newer one exists.
The 'vanilla' kernels are close to those being released and do not have any Fedora modifications; which are patches, security modifications and optimizations made on them.
If you want the mainline Fedora kernel, when you do a system update it will be part of it, if a new kernel version exists.
The command to perform the update is:
Code:
sudo dnf upgrade
Arch
When updating the Arch system, it should automatically update the kernel.
To perform an update, for all system files and the kernel, use the command:
Code:
sudo pacman -Syu
After performing an update, you may need to update your boot loader before rebooting the system.
If you do not want the main-line kernel, then you can install a vanilla version, as we have covered the vanilla version above.
To do this, you need an AUR helper, such as 'yay'. For this, do the following after you update your packages from the repositories:
Code:
sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
If the system prompts you about installing dependencies or the like, just accept the defaults.
The installation of the AUR helper may take a while to complete. Once it is complete, you can run 'yay' to update its repository lists.
To install the kernel, use the command:
Code:
yay -S linux-mainline
You can also install the long-term (lts) with the command:
Code:
yay -S linux-lts
You can get a listing of the latest kernel version with one of the following commands, depending on which type you prefer:
Code:
yay -Sss linux-mainline
yay -Sss linux-lts
For example, my current system is running version '6.16.4-arch1-1'. For the mainline version, I can install version '6.17rc4-1' and for the LTS version '6.12.44-1'.
The first time you run this command, there will be a lot of dependencies installed and keys imported. Keep close during the initial install since it will ask a lot for you to verify various steps.
The kernel install will take more time since the system compiles the kernel from source code.
If you have your 'initramfs' on a separate partition, you may need to build it yourself. Also, update the boot loader for the new kernel.
Checking the Kernel
After rebooting, you need to check the basic functionality of the system. Make sure all the hardware is working, such as:
- display
- keyboard/mouse
- networking (wired/wireless)
- Bluetooth
- audio
- USB ports
- any other connected peripherals
Another trick is that if there are boot issues, try a second time, just in case.
A good choice is to have a boot loader like GRUB that allows you to select a different kernel version if the current one has issues.
Conclusion
Some users like to keep their systems updated to the most current version of all the apps. Sometimes this includes the kernel.
With these instructions, you can keep your system up to date with a mainline or long-term-support kernel, depending on your preference and system use.
If you need a very stable version, you may stick to the version that is downloaded during a normal update, or even the LTS version.

