How To Change The Default Kernel In Ubuntu 22.04 | 20.04 LTS

0

Learn the steps to install the latest Linux kernel on Ubuntu 20.04 LTS Focal fossa or Ubuntu 22.04 Jammy Jelly Fish to change the default one using command terminal.

Kernel is the base program of any Linux based operating system which offers a meditation between the software and the hardware of the computer system. It implies on any hardware device running with software. And when we wrap it with a layer of graphical user interface and other applications around the kernel, we have a full-fledged Linux operating system like Ubuntu. Well, Kernel keeps the work in the background and ensures that the operating system is working and the hardware and software can be put into use.

Well ‘Linux Kernel’ is not the right term to use, there is a Linux one and it is the so called kernel. All popular operating systems based on this GNU kernel are called “Linux operating systems”.

In short, a Linux distribution is – Kernel + GUI (X server) + software + additional tools = desktop Linux operating system. While the Linux server, skip the GUI part to become a pure command line server.

Therefore, each time we install a Linux distribution such as Ubuntu, a kernel is installed automatically because without it the whole system could not work. Also, we can update and download kernels on Ubuntu like any other package, here we will see how?

Steps to change the default kernel in Ubuntu 22.04 | 20.04 LTS

1. Check your current kernel version

Before changing the default kernel of your Ubuntu Linux, let’s first check what exactly is the current version running on our system. For this open your command terminal, if you are using the GUI desktop version it can be opened using the keyboard shortcut – Ctrl+Alt+T.

uname -r

2. Run system update and have wget

Let’s make sure everything on our system is up to date first, and then we’ll move on to the next step. Therefore, start by running apt update & upgrade command and also install wget tool too.

sudo apt update && sudo apt upgrade
sudo apt install wget

3. Download the Bash script to change the kernel

However, the user can directly download the Kernel Deb binary package from Ubuntu’s Linux repository; however, to easily install, update and uninstall kernels on Ubuntu 22.04 | 20.04 LTS, we can use the script available on GitHub. Use the given command to download the script to your Ubuntu system.

wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh

Once the script is installed on your system, make it executable and move it to /usr/local/bin to easily use it in the future to get the latest kernel version.

chmod +x ubuntu-mainline-kernel.sh
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/

4. Check available kernel versions to install

We have the script in its place, now we can use it to check which versions are available to install in addition to the one already existing on our system.

To find the latest version available to install:

ubuntu-mainline-kernel.sh -c

Check the latest Ubuntu kernel versions

While to list all available kernel versions that you can install are:

ubuntu-mainline-kernel.sh -l

list all available kernel versions

5. Modify or upgrade default Ubuntu 22.04 | 20.04 Kernel Version

Well, now we can either update the default version or replace it with any other available version we want, but first, install it. Here is the command :

To install the latest version available:

sudo ubuntu-mainline-kernel.sh -i

6. To install a specific or older version:

sudo ubuntu-mainline-kernel.sh -i version-number

To note: Replace the “version number in the command above with the one you want to install, for example, to get version v5.15.11 instead of the latest then the command will be:

sudo ubuntu-mainline-kernel.sh -i v5.15.1

Install an old or specific version of the Ubuntu kernel

Once the installation is complete, we can use the same script to list what kernel versions are available on our system:

sudo ubuntu-mainline-kernel.sh -l

Restart your system

Reboot your system to allow your system to use the latest installed kernel version.

sudo reboot

After the system restarts, check your current version using:

uname -r

This time you will see the last one.

7. Change or set default kernel version

By default, Ubuntu will automatically select the latest installed version of the kernel, but if you want to set another version, choose to start with boot. In this case, we manually tell the system to choose which version.

Next, edit the Grub.

sudo nano /etc/default/grub

Add the following two lines, to get an idea you can see the screenshot.

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved

Set Default Ubuntu Kernel Version

Save the file CTRL+Opress the Enter key, then exit it CTRL+X.

Now restart your system:

sudo reboot

And when you start your system, press the key Esc button to get the Grub menu. Select “Advanced options for Ubuntu“, then select the kernel version you want to set as the default version on your system.

Advanced options for Ubuntu Select the default kernel you want to use

8. Uninstall or remove

To remove any existing kernel from your system, run:

sudo ubuntu-mainline-kernel.sh -u

Select the serial number of the version you want to completely remove from your system.

Uninstall kernel version installed on Ubuntu 22.04

Conclusion

How to Install Linux Kernel 5.x on Almalinux 8 or Rocky
Install Bpytop on Ubuntu 22.04/20.04
Whatsdesk – Install WhatsApp client on Ubuntu 22.04 | 20.04
3 Ways to Install and Use HandBrake Video Converter on Ubuntu 20.04/22.04

Share.

Comments are closed.