Linux Kernel 5.17 has been released with support for recursive id-mapped mounts; CO-RE support that creates compiled BPF programs more portable; a replacement P-state driver for contemporary AMD CPUs; the random number generator switched to BLAKE2s and got much faster; a replacement Real-Time Linux Analysis tool; the fscache networking caching backend was rewritten; new fanotify flag to interchange some inotify patterns; support for giving names to anonymous memory mappings.
Many other improvements have been included in the release, far too long to list. Please review Linux 5.17 Kernel release changelog for detailed changes before installing the new kernel.
In the following tutorial, you will learn how to install the latest 5.17 Linux Kernel on Ubuntu 20.04 LTS Focal Fossa using the command line terminal and how to remove and restore the original kernel.
Table of Contents
Update Ubuntu
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 apt update && sudo apt upgrade
Install Linux Kernel 5.17 – PPA Method
Import TuxInvader PPA
NOTE THIS PPA METHOD ONLY WORKS CURRENTLY FOR UBUNTU 20.04 LTS ONLY!!
The first option to install the Linux 5.17 kernels is to install the ppa:tuxinvader/lts-mainline by TuxInvader. This has some of the most up-to-date 5.17 and the previous 5.16 kernel builds and is often updated regularly.
The drawback is that this is an untrusted PPA and not an official release by the Ubuntu teams, but given the history of the PPA, it is safe as any other reputable PPA.
First, install the LTS Mainline Tuxinvader PPA as follows.
sudo add-apt-repository ppa:tuxinvader/lts-mainline -y
Once installed, update your repository list.
sudo apt update
Next, proceed to the installation of the Linux Kernel. Make sure that any sensitive documents are backed up just in case of anything going wrong.
Install Linux Kernel 5.17 from Tux PPA
Next, install the 5.17 generic Linux kernel drivers by executing the following command.
sudo apt-get install linux-generic-5.17 -y
Once complete, you will need to reboot your system for the new kernel to be fully activated.
reboot
Once logged back into your system, run the following command to confirm the new kernel version is running.
sudo uname -r
Example output:
For people that love pretty printouts, install the neofetch package.
sudo apt install neofetch -y
Now print your system specs that will show the kernel version as follows.
neofetch
Example output:
Install Linux Kernel 5.17 – Ubuntu Mainline Repo
The second option is to install the Linux Kernel is to download the .deb package from the Ubuntu mainline repository manually. This works well, but you will need to keep the maintenance up when new updates arise by manually re-installing the new kernel packages.
First, visit the Ubuntu Mainline Kernel 5.17 Repository and find the latest version, available is AMD64, ARM64, ARMHf, ppc64el, and s390x. The most common will be AMD64 for most users.
Example:
Next, download the required packages using the wget command.
Example (ONLY DO NOT USE):
Required for AMD64 users:
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-image-unsigned-5.17.0-051700-generic_5.17.0-051700.202203202130_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-modules-5.17.0-051700-generic_5.17.0-051700.202203202130_amd64.deb
Optional Extras for AMD64 users:
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-headers-5.17.0-051700_5.17.0-051700.202203202130_all.deb
Handy tip for s390x, ppc64el, armhf, and arm64 users, change the https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/ to https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/{alternative architecture/ or grab the links from the download page.
The required packages are what they mean, and you need to download those to install the Linux Kernel. The optional extras include support for DKMS modules and can be recommended to install for Desktop users.
Next, in the folder you downloaded the new Linux Kernel packages, give the packages executable permission using the following blanket command.
sudo chmod +x *.deb
Now begin the installation using the dpkg -i command.
sudo dpkg -i *.deb
Once complete, you will need to reboot your system for the new kernel to be fully activated.
reboot
Once logged back into your system, run the following command to confirm the kernel version is running.
sudo uname -r
Example output:
And that’s it; you have successfully installed the latest Linux Kernel 5.17.
How to Restore Default Kernel
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.
For users that installed the Tux PPA Mainline kernel, you must remove the repository by adding the –remove syntax to the previous add command.
sudo add-apt-repository --remove ppa:tuxinvader/lts-mainline -y
Now run an APT update.
sudo apt update
To begin the removal and restoration, use the following command.
sudo apt-get autoremove linux-generic-5.17* linux-headers-5.17* linux-image-unsigned-5.17* linux-modules-5.17* -y
Next, you will see the following prompt advising that you must make sure a kernel is installed or re-installed before you reboot if you remove the current kernel. Otherwise, your system will be destroyed, unbootable, broken, etc.
Example:
Press the tab key, select <No>, and press the ENTER KEY.
DO NOT REBOOT I REPEAT DO NOT REBOOT YET OR ELSE DO NOT CRY IF YOUR SYSTEM GETS BORKED.
Before we reboot, make sure the default generic is installed, do not fuss too much as you can install alternative versions later on as we are just trying to get your system back to working order.
sudo apt install --install-recommends linux-generic-hwe-20.04 -y
Now, you may notice it will show an output saying this is already installed, and then you did not remove the kernel after installing Linux Kernel 5.17; users who did this will re-install the latest recommended kernel for Ubuntu 20.04 LTS.
Now reboot.
reboot
Now verify the kernel installed, which should be the default generic kernel.
sudo uname -r
Example output:
As above, you have fallen back to the default kernel.
Alternative Kernels
For those that want different options besides the PPA or manually installing, check out the following custom kernel tutorials, which often boast the latest Linux custom-built kernels.
- How to Install XanMod Linux Kernel on Ubuntu 20.04 – Edge contains latest kernel.
- How to Install Liquorix Linux Kernel on Ubuntu 20.04 – Often up-to-date but not as fast as XanMod.
Comments and Conclusion
In the tutorial, you have learned how to install the latest 5.17 kernel on your Ubuntu 20.04 LTS Focal Fossa Desktop or Servers. Note, if your system is a production server, it would be advised to use the existing kernel that ships the standard installation for the most stability.
However, for those wanting to try kernel 5.17, take backups as many jump ahead sometimes and regret the decision. Ensure that the users who manually install the .deb packages keep checking for updates.