In this guide, we want to teach you How To Upgrade Linux Kernel on Ubuntu 22.04.
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel.
In broad terms, an OS kernel performs three primary jobs.
- It provides the interfaces needed for users and applications to interact with the computer.
- It launches and manages applications.
- It manages the underlying system hardware devices.
The latest Linux kernel is 6.0. If you are curious, here are some features that are part of the Linux Kernel 6.0 release:
- Inclusion of Rust code (early phase)
- Real-time Kernel building support
- New Hardware support
- Usual Improvements to various Filesystems
- Scheduler changes
Steps To Upgrade To Latest Linux Kernel on Ubuntu 22.04
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 22.04.
Now follow the steps below.
Update Ubuntu 22.04 Repository
First, you must update and upgrade your Ubuntu system to ensure all existing packages are up to date. To do this, run the command below:
sudo apt update && sudo apt upgrade
Check the Current Kernel Version on Ubuntu 22.04
At this point, use the following command to check your current Linux kernel:
Output Linux 5.15.0-46-generic x86_64
The given output indicates that we have Linux kernel version “5.15.0-46-generic” on our Ubuntu 22.04 system.
Import Jammy Mainline Tuxinvader PPA Repository
The best option to install the Linux 6.0 kernels is to install the ppa:tuxinvader/jammy-mainline by TuxInvader. This has some of the most up-to-date mainline generic kernels and the previous 5.19 kernel.
To do this, run the following command:
sudo add-apt-repository ppa:tuxinvader/jammy-mainline -y
When you are done, update your local package index:
sudo apt-get update
Install Linux Kernel 6.0 on Ubuntu 22.04
Next, proceed to the installation of the Linux Kernel. Ensure that any sensitive documents are backed up in case anything goes wrong.
At this point, install the 6.0 generic Linux kernel drivers by running the following command:
sudo apt-get install linux-generic-6.0
Note: This will only work during the lifetime of Linux Kernel 6.0. After its EOL, the command will not work, and you should not be seeking to install the generic version, regardless.
When your installation is completed, you will need to reboot your system for the new kernel to be fully activated:
Once logged back into your system, run the following command to confirm the new kernel version is running:
In your output you will see:
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:
Restore the Default Kernel on Ubuntu 22.04
If you plan to restore the default kernel for any reason, follow the steps below.
First, you must remove the Jammy Mainline Tuxinvader PPA Repository. To do this, run the command below:
sudo add-apt-repository --remove ppa:tuxinvader/jammy-mainline -y
Then, run the system update:
sudo apt update
Next, use the command below to start your removal process:
sudo apt-get autoremove linux-generic-6.0* linux-headers-6.0* linux-image-unsigned-6.0* linux-modules-6.0* -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.
Press the tab key, select <No>, and press the ENTER KEY.
At this point, you must install the default generic by using the command below:
sudo apt install --install-recommends linux-generic-hwe-22.04 -y
Note: You may notice it will show an output saying this is already installed. You did not remove the kernel after installing Linux Kernel 6.0; users who did this will re-install the latest recommended kernel for Ubuntu 22.04 LTS.
When you are done, reboot your system:
Now verify the kernel installed, which should be the default generic kernel.
sudo uname -r
At this point, you have learned to Upgrade Linux Kernel on Ubuntu 22.04.
Hope you enjoy it.
You may be interested in these articles: