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 core software that drives any Linux distribution. This is what Linus Torvalds created around 30 years ago and this is what he still works on.

A newer version of Linux kernel is released every few months with new features (such as support for more hardware), bug fixes etc.

But most Linux distribution does not provide the latest Linux kernel unless you are using an Arch-based distribution or some other rolling release distribution.

Linux distributions are responsible for your system’s stability and this is why they don’t release a newer version of Linux Kernel to its users unless they test it for regression on their end. They often use a specific kernel release as base and provide you updates on this base kernel, instead of giving you the latest mainline kernel.

This does not mean that you cannot use the latest Linux kernel in Ubuntu or other distribution you are using.

In this tutorial, I’ll discuss various ways to get a new Linux kernel on Ubuntu.

Using the latest Linux kernel version in Ubuntu: Things you should know

In my opinion, there is no ‘real’ need of upgrading to a newer Linux kernel unless it provides you a good enough reason.

Why install a new Linux kernel version manually?

What could be such a reason? Well, suppose the new Linux kernel introduces support for your sound card or Wi-Fi card or some other hardware component. You read some official forum that the problem you are having with the hardware component could be fixed with a newer Linux kernel version.

HWE kernel option is also available

You should also keep in mind that Ubuntu has this hardware stack enablement (HWE) feature that lets you use somewhat newer Linux kernel on an Ubuntu LTS release.

Older kernels remain available

Another thing to note here is that installing a new kernel doesn’t mean that the older kernel has been removed from the system. It remains at your disposal. By default, Ubuntu boots into the newest Linux Kernel installed on the system.

Two ways of installing new kernel in Ubuntu: Command line and GUI

There are two ways to install newer Linux kernel:

The GUI tool Ukuu is not open source anymore and it locks a few feature which I have discussed in its section.

Let’s see the methods.

Method 1: Manually install new Linux kernel in Ubuntu using command line

The latest Linux kernel is called mainline Linux kernel. You’ll see this term used often.

Warning!

I must warn you that you should be aware of the risk. If something goes wrong, you may revert to a previous Kernel version but you must not panic. Make a backup of Ubuntu system to be sure. If you are easily baffled with troubleshooting, avoid playing with manual upgrades and stick to your distribution’s system updates.

Step 1: Check current installed version

You may want to first check current installed version of kernel. You can do this by using the uname command in the terminal:

uname -r

As you can see in output below, I have kernel version 5.4 installed.

[email protected]:~$ uname -sr
Linux 5.4.0-40-generic

Step 2: Download the mainline Linux kernel of your choice

Now you have to download the desired kernel build provided Ubuntu from here.

You can see kernel list like this. I am going to download kernel 5.7. You also should keep in mind to install the stable kernel instead of rc (release candidate).

Download mainline Linux kernel from Ubuntu
Download mainline Linux kernel from Ubuntu

Now download appropriate kernel files for your architecture. For 64 bit architecture, you should download these kind of files

  • linux-headers-VERSION-NUMBER_all.deb
  • linux-headers-VERSION-NUMBER_amd64.deb
  • linux-image-VERSION-NUMBER_amd64.deb
  • linux-modules-VERSION-NUMBER_amd64.deb

Hence I will download these files:

Download mainline Linux kernel in DEB format
Install New Linux Kernel 3 1

Step 4: Install the downloaded kernel

Now it’s time to install downloaded kernel. First do into the directory where you’ve downloaded kernel and enter following command. Make sure there isn’t any other “.deb” file in that directory other than downloaded kernel files.

sudo dpkg -i *.deb

Install the new kernel in Ubuntu

It will take some time. After installation finished, you will see screen like this.

New kernel installed in Ubuntu

Step 5: Reboot Ubuntu and enjoy the new Linux kernel.

Now you’ve installed new kernel in Ubuntu successfully, it’s time to reboot the machine. Ubuntu by default boots into the newer kernel version.

After rebooting, check kernel version with same uname -sr command you used earlier. As you can see, it’s updated to 5.7.0.

Check kernel version after install a new Linux kernel in Ubuntu

Rollback the changes and downgrade Linux kernel

If you didn’t like new Linux Kernel or if you discovered issues with it. You can easily downgrade the Kernel. You just have to:

  • Boot into an older kernel
  • Remove the newer Linux kernel you don’t want

Let’s see how to do that.

When you are booting into your system, on the grub menu, select the Advanced options for Ubuntu.

If you do not see the grub menu, try holding the shift key or use Esc key to bring the grub menu.

Select advanced options for Ubuntu to boot into an older Linux kernel

In here, you’ll see all the Linux kernels installed on your system. Select an older one. Don’t choose the recovery mode, just go with the normal ones.

Boot into older Linux kernel version

Now that you have booted into your good old kernel, we have to remove new kernel.

You can use the apt or dpkg command to remove the installed kernel version. Do you remember the version of new kernel you installed manually? For me it was kernel 5.7. So here’s what I use to delete it.

Change the commands with the version you want to install:

sudo apt remove linux-headers-5.7.0*
sudo apt remove linux-image-5.7.0*
sudo apt remove linux-modules-5.7.0*

You can see, I have two packages associating with kernel 5.7.0. If I remove the first package it will automatically remove all it’s related dependencies.

Delete installed new Linux kernel

Method 2: Upgrade Linux Kernel in Ubuntu Ukuu GUI tool

You can upgrade Linux kernel on your own in Linux command line. But the kernel upgrade procedure is much easier and more convenient with a GUI tool called Ukuu (Ubuntu Kernel Update Utility).

This GUI tool is developed by Tony George who has provided us with several other useful tools for Ubuntu such as battery monitor for Ubuntuapp backup tool Aptik etc.

You should know that Ukuu of version above 18.9 is now paid and closed source. Version 18.9 is still free and open source.

Paid version contains additional features like:

  • Downloading and installing newer kernel versions automatically
  • Deleting downloaded packages after install
  • Option to stay on same series of a kernel release
  • Automatically removing older kernels.
  • UI improvements.

If you want the additional features, you can purchase it from developer’s official website. Ukuu free version can still be used for installing and removing kernels, though.

Step 1: Install Ukuu in Ubuntu

You can download the deb files for the old Ukuu version 18.9 which is free to use but not updated lately.

Step 2: Install kernel with Ukuu

Once you have installed Ukuu, start it. It will refresh the list of available Linux kernels available for Ubuntu.

By default, it will show you all the available kernels, including the unstable release kernel (tagged with RC and with red Tux icon).

Kernel versions from the distributions are labeled with the logo and the other versions have just the good old Tux logo.

Install New Linux Kernel 11 using Ukuu

As you can see I have kernel 5.7.0 installed already, now I will install kernel 5.7.1 using Ukuu.

Again, you should avoid the release candidates. Select the desired Kernel version and click on install to install the newer Linux kernel version.

Installing new kernel in Ubuntu using Ukuu

Of course, it will require admin password for this action. Once you have entered your password, you can see the installation progress in the application itself. Focus on the end result to know if it new Linux kernel was installed successfully or not.

installing new kernel in Ubuntu

Note: If the installation fails, no need to panic. Nothing will be wrong the system. Just try a different Kernel version and it might work.

You should see something like this when installation finished successfully.

successfully installed new Linux kernel in Ubuntu using Ukuu

Once installation finishes, you’ll see a very helpful screen that tells you if anything goes wrong with the new Linux kernel, you can always choose to boot into the older kernel from the grub menu.

Ukuu after installing new Linux kernel

When you boot into the system next, you’ll be running the Linux kernel you had just installed.

Rollback the changes/Downgrade Linux Kernel with Ukuu

Rollbacking done in two steps:

  • Boot into an older kernel
  • Remove the newer Linux kernel you don’t want

Let’s see how to do that.

When you are booting into your system, on the grub menu, select the Advanced options for Ubuntu.

Install New Linux Kernel 7

Select your old kernel to boot into it.

Boot into older Linux kernel in Ubuntu

Once you boot into the system with the older Linux kernel, start Ukuu again. Make sure that you are not deleting the kernel that you are running at present.

Select the newer kernel version which you don’t want anymore and click on Remove.

Delete an installed Linux kernel version using Ukuu in Ubuntu

That’s all you need to do here to downgrade the Linux kernel in Ubuntu.

While we are discussing it, I would like to point out a few more features of Ukuu. Ukuu has settings option that allows you to not display release candidates of kernels in the list. You can also hide Linux kernel versions older than version 4.0.

Ukuu Linux kernel tool settings

You can also choose the option to display desktop notifications in case new Linux Kernel are available.

You can also remove Ukuu using apt remove ukuu command.

How do you upgrade Linux kernel?

I hope this tutorial was helpful to show you how to install mainline Linux kernel in Ubuntu.

So, do you often upgrade Linux kernel on your own or do you wait for your distribution to provide the upgrade? How do you do it?

Similar Posts

  • How do I undo this ?

    I have downloaded a new kernel and have installed it and it
    gave 3 errors :

    Sélection du paquet linux-headers-5.14.0-051400 précédemment désélectionné.
    (Lecture de la base de données… 392010 fichiers et répertoires déjà installés.)
    Préparation du dépaquetage de linux-headers-5.14.0-051400_5.14.0-051400.202108292331_all.deb …
    Dépaquetage de linux-headers-5.14.0-051400 (5.14.0-051400.202108292331) …
    Sélection du paquet linux-headers-5.14.0-051400-generic précédemment désélectionné.
    Préparation du dépaquetage de linux-headers-5.14.0-051400-generic_5.14.0-051400.202108292331_amd64.deb …
    Dépaquetage de linux-headers-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    Sélection du paquet linux-headers-5.14.0-051400-lowlatency précédemment désélectionné.
    Préparation du dépaquetage de linux-headers-5.14.0-051400-lowlatency_5.14.0-051400.202108292331_amd64.deb …
    Dépaquetage de linux-headers-5.14.0-051400-lowlatency (5.14.0-051400.202108292331) …
    Sélection du paquet linux-image-unsigned-5.14.0-051400-generic précédemment désélectionné.
    Préparation du dépaquetage de linux-image-unsigned-5.14.0-051400-generic_5.14.0-051400.202108292331_amd64.deb …
    Dépaquetage de linux-image-unsigned-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    Sélection du paquet linux-image-unsigned-5.14.0-051400-lowlatency précédemment désélectionné.
    Préparation du dépaquetage de linux-image-unsigned-5.14.0-051400-lowlatency_5.14.0-051400.202108292331_amd64.deb …
    Dépaquetage de linux-image-unsigned-5.14.0-051400-lowlatency (5.14.0-051400.202108292331) …
    Sélection du paquet linux-modules-5.14.0-051400-generic précédemment désélectionné.
    Préparation du dépaquetage de linux-modules-5.14.0-051400-generic_5.14.0-051400.202108292331_amd64.deb …
    Dépaquetage de linux-modules-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    Paramétrage de linux-headers-5.14.0-051400 (5.14.0-051400.202108292331) …
    dpkg: des problèmes de dépendances empêchent la configuration de linux-headers-5.14.0-051400-generic :
    linux-headers-5.14.0-051400-generic dépend de libc6 (>= 2.33) ; cependant :
    La version de libc6:amd64 sur le système est 2.31-0ubuntu9.9.

    dpkg: erreur de traitement du paquet linux-headers-5.14.0-051400-generic (–install) :
    problèmes de dépendances – laissé non configuré
    dpkg: des problèmes de dépendances empêchent la configuration de linux-headers-5.14.0-051400-lowlatency :
    linux-headers-5.14.0-051400-lowlatency dépend de libc6 (>= 2.33) ; cependant :
    La version de libc6:amd64 sur le système est 2.31-0ubuntu9.9.

    dpkg: erreur de traitement du paquet linux-headers-5.14.0-051400-lowlatency (–install) :
    problèmes de dépendances – laissé non configuré
    dpkg: des problèmes de dépendances empêchent la configuration de linux-image-unsigned-5.14.0-051400-lowlatency :
    linux-image-unsigned-5.14.0-051400-lowlatency dépend de linux-modules-5.14.0-051400-lowlatency ; cependant :
    Le paquet linux-modules-5.14.0-051400-lowlatency n’est pas installé.

    dpkg: erreur de traitement du paquet linux-image-unsigned-5.14.0-051400-lowlatency (–install) :
    problèmes de dépendances – laissé non configuré
    Paramétrage de linux-modules-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    Paramétrage de linux-image-unsigned-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.4.0-113-generic
    I: /boot/initrd.img.old is now a symlink to initrd.img-5.4.0-113-generic
    I: /boot/vmlinuz is now a symlink to vmlinuz-5.14.0-051400-generic
    I: /boot/initrd.img is now a symlink to initrd.img-5.14.0-051400-generic
    Traitement des actions différées (« triggers ») pour linux-image-unsigned-5.14.0-051400-generic (5.14.0-051400.202108292331) …
    /etc/kernel/postinst.d/dkms:
    * dkms: running auto installation service for kernel 5.14.0-051400-generic

    Kernel preparation unnecessary for this kernel. Skipping…
    applying patch disable_fstack-clash-protection_fcf-protection.patch…patching file Kbuild
    Hunk #1 succeeded at 82 (offset 11 lines).

    Building module:
    cleaning build area…
    unset ARCH; [ ! -h /usr/bin/cc ] && export CC=/usr/bin/gcc; env NV_VERBOSE=1 ‘make’ -j16 NV_EXCLUDE_BUILD_MODULES=” KERNEL_UNAME=5.14.0-051400-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/5.14.0-051400-generic/build LD=/usr/bin/ld.bfd modules…..(bad exit status: 2)
    Error! Bad return status for module build on kernel: 5.14.0-051400-generic (x86_64)
    Consult /var/lib/dkms/nvidia/470.129.06/build/make.log for more information.
    …done.
    /etc/kernel/postinst.d/initramfs-tools:
    update-initramfs: Generating /boot/initrd.img-5.14.0-051400-generic
    /etc/kernel/postinst.d/zz-update-grub:
    Sourcing file `/etc/default/grub’
    Sourcing file `/etc/default/grub.d/50_linuxmint.cfg’
    Sourcing file `/etc/default/grub.d/init-select.cfg’
    Création du fichier de configuration GRUB…
    Image Linux trouvée : /boot/vmlinuz-5.14.0-051400-lowlatency
    Image Linux trouvée : /boot/vmlinuz-5.14.0-051400-generic
    Image mémoire initiale trouvée : /boot/initrd.img-5.14.0-051400-generic
    Image Linux trouvée : /boot/vmlinuz-5.4.0-113-generic
    Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-113-generic
    Image Linux trouvée : /boot/vmlinuz-5.4.0-91-generic
    Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-91-generic
    Adding boot menu entry for UEFI Firmware Settings
    fait
    Des erreurs ont été rencontrées pendant l’exécution :
    linux-headers-5.14.0-051400-generic
    linux-headers-5.14.0-051400-lowlatency
    linux-image-unsigned-5.14.0-051400-lowlatency

    What should I do ?

  • What should I do if I get “you need to load the kernel first” after selecting the one I installed (5.15.7) from grub?