Great news, Linus Torvalds has Linux Kernel 6.1 on Dec , 2022, and brings initial Rust language support in mainline Kernel for better security and memory-safe code, which has been hyped about for a while. Besides the usual performance enhancements, Linux Kernel 6.1 would be desired but primarily for users with new hardware that is unsupported or has current known issues in your existing Kernel. Certain Linux distributions, such as Rocky Linux, focus on long-term stability, so you will need to use a third party to install the latest Kernel and keep up-to-date with the minor updates that will come out almost daily to weekly with any new kernel and the best option to do this is with ELRepo.
As discussed in the introduction, the best option is to use the ELRepo repository, which has an excellent reputation amongst EL9 and EL8 distributions such as AlmaLinux, CentOS, Oracle, etc. The following tutorial will show you how to import the ELRepo for Rocky Linux 9 or Rocky Linux 8 desktop or server using cli commands for the users that require to update their Kernel for better hardware support.
Recommended Steps Before Installation
Before you begin, update your system to ensure all existing packages are up to date, as this is essential when installing/upgrading Linux kernels to avoid conflicts.
sudo dnf upgrade --refresh
Import ELRepo on Rocky Linux
The first step is to import the repository from the ELRepo project. This has the latest available mainline Kernel with regular updates, so you do not need to compile kernels and install and upgrade using the dnf package manager.
First, import the GPG key to verify the installation package.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Next, install the repository with the following command; ensure you import the correct version for your distribution version; if not, your kernel installation will fail.
Import ELRepo EL9
sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm -y
Import ELRepo EL8
sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm -y
To verify the imported repository, you can search ELRepo to see the supported kernels available for installation.
dnf list available --disablerepo='*' --enablerepo=elrepo-kernel
bpftool.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-core.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-devel.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-devel-matched.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-doc.noarch 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-headers.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-modules.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-modules-extra.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-tools.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-tools-libs.x86_64 6.1.0-1.el9.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 6.1.0-1.el9.elrepo elrepo-kernel perf.x86_64 6.1.0-1.el9.elrepo elrepo-kernel python3-perf.x86_64 6.1.0-1.el9.elrepo elrepo-kernel
Install Linux Kernel 6.1 on Rocky Linux
The first option is to install the latest Linux Kernel from the stable branch. Given that Rocky Linux focuses on being extremely durable, this kernel version may bring inconsistencies, but for most systems, it should work fine and increase performance. Always have a backup solution in place when installing kernels on critical systems like you would with any significant packages.
In your terminal, use the following command to begin the installation.
sudo dnf --enablerepo=elrepo-kernel install kernel-ml kernel-ml-core kernel-ml-headers kernel-ml-modules kernel-ml-modules-extra -y
Now reboot your system; during the boot window with kernels to choose from, select kernel 6.1 if this option is not selected automatically. Remember, you can switch to any kernel listed here for any problems.
Once back in your system, verify the new Kernel and build by checking the Kernel.
Or, for more detailed information, use something like the hostnamectl command.
Congratulations, you have installed the latest 6.1 Linux kernel on your Rocky Linux 9 or 8 workstation desktop or a headless server.
Update Kernel from ELRepo on Rocky Linux
ELRepo uses the DNF manager, as you would have noticed when installing the Kernel. To check and keep the Kernel up to date, use the following command as you would with any other package.
sudo dnf upgrade --refresh
Remember, for any kernel updates; you will need to reboot your system.
Restore Default Kernel on Rocky Linux
For users who find the new Kernel has bugs for their hardware, say, loss of sound, use the following steps to restore the default kernel; if you installed an alternative kernel, replace the default kernel section with whatever you want to install.
First, disable the ELRepo repository using the following command.
sudo dnf config-manager --set-disabled elrepo
Confirm this repository has been disabled using the following dnf repolist command.
Next, re-install the default kernel packages.
sudo dnf reinstall kernel kernel-core kernel-modules kernel-headers
Users that have removed all unused kernels use the install command instead.
sudo dnf install kernel kernel-core kernel-modules kernel-headers
Remember to reboot.
Select Linux Kernel default on system boot, and this is probably the simple way to revert to the Kernel.
Once you have returned to your system, I suggest confirming the 6.1 Linux kernel has been removed.
Lastly, you can optionally remove all unused kernels. I would cite caution for this.
sudo dnf --setopt=protected_packages= remove $(rpm -q kernel-core | grep -v $(uname -r))