Skip to main content
How To

Upgrading Linux Kernel in Ubuntu

Learn how to upgrade the kernel version in Ubuntu command line. Also learn about easily installing mainline Linux kernel.

Sagar Sharma

Want to upgrade your kernel on Ubuntu? Well, in this guide, I will be sharing two ways to do so:

  • Upgrade to a newer kernel provided by Ubuntu's repository
  • Installing the latest mainline kernel (unofficial)

Let me share a quick command to install the most recent kernel made available by Canonical (parent company of Ubuntu):

sudo apt update && sudo apt upgrade


Upgrade the Ubuntu kernel from the default repository

Yes. You just need to update your system. If there is a newer kernel version available in the updates, it will be installed.

First, check the current kernel version using the following command:

uname -r
check the kernel version in ubuntu

Next, update the repositories to find the pending updates:

sudo apt update
update repositories in ubuntu

And if you see pending updates, you can execute the following command to update your system:

sudo apt upgrade

Once done, reboot your system and check the kernel version.

If the update had a kernel update, it should get you a new kernel:

uname -r
check the kernel version of ubuntu

And as you can see, it upgraded the kernel from 5.19 to 6.0.

New Book: Efficient Linux at the Command Line

Pretty amazing Linux book with lots of practical tips. It fills in the gap, even for experienced Linux users. Must have in your collection.

Get it from Amazon

Install mainline kernel in Ubuntu via unofficial PPA

If you don't know, the mainline kernel is maintained by Linus Torvalds and introduces all new features implemented.

So you get to use the spicy stuff before anyone else.

To install the mainline kernel, you'd need a package named mainline.

Which can only be installed by using PPA on Ubuntu. So first, add the PPA by the following command:

sudo add-apt-repository ppa:cappelikan/ppa

Next, use the following command to update repositories and install the mainline package:

sudo apt update && sudo apt install mainline

Now, check available latest kernel update and latest point release for your system:

mainline --check

To install the latest mainline kernel, you will have to use the following command:

sudo mainline --install-latest
install the latest mainline kernel in ubuntu

Whereas if you are looking for the latest point release for your kernel, use the following:

sudo mainline --install-point

Once you are done with the download, a reboot is required to take effect from the new kernel.

Now, check the kernel version and it will show the most recent mainline kernel:

uname -r 
get the most recent version of mainline kernel in ubuntu

But you can do the entire process with GUI.

So if you have access to GUI, you can the given guide that explains the complete usage of the mainline package with GUI:

How to Install the Latest Mainline Linux Kernel Version in Ubuntu [GUI and Terminal Methods]
This article shows you how to upgrade to the latest Linux kernel in Ubuntu. There are two methods discussed. One is manually installing new kernel and the other uses a GUI tool providing even easier way. I am assuming that you already know what is Linux kernel. This is the

Roll back to the previous kernel in Ubuntu

If you are facing stability issues with the latest kernel, you can always roll back to the previous kernel.

To roll back to the old kernel, restart your system and select the Advanced options for Ubuntu option.

And then, select the previous kernel and hit enter:

switch back to old kernel in ubuntu

Yep, it's that simple.

Learn Linux Quickly - Linux Commands for Beginners
Learn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics. Learn Linux Quickly will teach you the following topics:Insta…

Know how many kernels you have

Ubuntu and other Linux distributions keep the old kernel in case you face any issues running the latest one.

And we have detailed guide on how you can list installed kernels in your system:

How to List Installed Kernels in Ubuntu
Ubuntu keeps more than one Linux kernel installed on the system. Here’s how to know which kernel versions are installed on your system.

I hope you will find this helpful and if you have any queries, let me know in the comments.

Sagar Sharma