Linux Kernel

Upgrade Kernel on Linux Mint

For using any computer, it’s a must to have a suitable operating system that will operate the machine for you. Now, if we go deeper into the hierarchy, for any operating system, the most important part of the operating system is the “kernel”.The question arises naturally – what the heck is the kernel? The kernel is the part of the OS that’s responsible for performing the hardware-level interaction. It sits in-between the hardware and the OS + other software. In fact, kernel is the piece of software that holds the ultimate power over the hardware of the system.For understanding the concept of kernel, let’s consider ourselves – the humans. Assume that the OS + all the other software is your brain and your mind while your body is the hardware. You think something using your brain, your body does the task. But the signal of doing that task has to be carried to the hardware in a way, right? In our case, we got the nervous system. The kernel in an OS holds the same significance.

Linux kernel

Each of the operating systems use their own kernels. For example, Windows uses its proprietary kernel whereas most other operating systems, especially the open-source ones use the well-known, tested and proven Linux kernel.

The Linux kernel is a living marvel of the software world. It’s one of the FINEST pieces of software that’s both INCREDIBLY complex and so, INCREDIBLY powerful with an INCREDIBLE community backing it up. It’s the core of all the Linux distros. Started by Linus Torvalds, Linux kernel v1.0.0 came out back in 1994. Now, it’s 2019 and the latest version is 4.20.5 (stable).

Throughout its course, the Linux kernel is getting advanced day by day. The kernel update is released every couple months with improved performance, stability, bug fixes, patches and additional features.

However, not all the Linux distros instantly incorporate the latest update right away. After the release, it usually takes time for getting it into your system officially.

That’s why I love to manage the kernel by myself.

Before we proceed any further, it’s worth to mention that unless you’re sure that you need that next-gen kernel, it’s not really worth making the leap. The kernel that comes with the distro is well-maintained by the developers as well.

Manage kernel on Linux Mint

If you’re a user of Linux Mint, then it’s way easier to perform “proven” actions on the kernel without worrying about something going wrong. Of course, things can go completely out of whack if you become too much adventurous. There are 2 available ways for managing a newer kernel version – using a GUI tool named “Ukuu” and installing the kernel manually.

Changing kernel using Ukuu

Ukuu is available directly for all the Debian/Ubuntu-based distros via the PPA.

Fire up a terminal –

Add the Ukuu repository –

sudo add-apt-repository ppa:teejee2008/ppa

Now, update the APT repository cache –

sudo apt update

Finally, install Ukuu –

sudo apt install ukuu

Launch Ukuu –

As you can see, the ones with the Ubuntu mark are the installed ones. The others are stable kernel releases throughout the journey.

It’s clear that my Linux Mint system is using Linux Kernel 4.15. It’s a quite old model.

Let’s install Kernel v4.18.20. Select the kernel and hit “Install”.

The installation process will start immediately.

Now, reboot your system for completing the installation.

Voila! The new kernel is all set!

Changing kernel manually

Note that this is a more risky process and might end up with some unwanted issues with your system.

  • Downloading the kernel

At first, download the latest Linux kernel package.

  • Verify the package

The process of downloading isn’t complete YET, unless you’ve ensured that the file is the verified package. Don’t you DARE skipping this step! Because it’s the kernel, even the slightest bit change can cause serious trouble!

Verify the downloaded package –

unxz linux-4.20.5.tar.xz
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.20.5.tar.sign

Upon trying to verify the package,

gpg --verify linux-4.20.5.tar.sign

See? It’s not possible. Grab the public key from the PGP keyserver –

gpg --recv-keys <key_string>

Here, the key string is going to be the key that the previous command showed.

Once the download is complete,

You can successfully verify the signature of the downloaded file.

The warning should be fine as long as you don’t get “BAD signature”. Now, it’s safe to proceed with the rest of the installation process.

tar -xvf linux-4.20.5.tar

  • Configuring kernel features and modules

Now, before you install the new kernel, you must configure its features. You also must specify all the necessary kernel modules that your system needs.

This can be overwhelming, so we’ll be using the existing config file. Run the following command –

cd linux-4.20.5/
cp -v /boot/config-$(uname -r) .config

  • Install the necessary compiler tools

For building the kernel package, you need the necessary dependencies available. Otherwise, the building step is going to be a mess.

sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev

  • Configuring the kernel for build

There are 3 available options –

  • make menuconfig
    Text-based radio lists, color menus and dialogs. Useful for remote servers.
  • make xconfig
    X Windows (Qt) based config tool. It works the best under KDE desktop.
  • make gconfig
    X Windows (GTK) based config tool. It works the best under GNOME destkops.
  • make oldconfig
    A series of y/N questions that you’re free to skip by pressing Enter.

For my case, I’ll be going with “make oldconfig”.

Just hold Enter until the nightmare ends!

  • Building the kernel

This is going to take a while, folks. Let’s concentrate on something else! It’s also going to take a lot of disk space and by that, I mean A LOT!

make -j4
  • Installing the kernel

Start installing the kernel with the modules.

sudo make modules_install

Then, it’s time to install the kernel itself.

sudo make install
  • Update GRUB config

Run the following commands –

sudo update-initramfs -c -k 4.20.5
sudo update-grub

For taking the result into effect, reboot your system.

About the author

Sidratul Muntaha

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.