Debian

How to Upgrade Kernel on Debian

The Linux Kernel is the core of the Linux operating system that acts as a bridge between the users, the applications and the hardware. The Kernel manages all the basic functions of your operating system, such as memory management, device drivers and process scheduling. If you are a Debian user, you must ensure running the system with the latest Kernel version. It will optimize the system performance, enhance the system’s security and ensure compatibility with the latest hardware.

This guide will cover the process of upgrading the Kernel on your Debian system.

Outline:

How to Upgrade Kernel on Debian

To upgrade Kernel on Debian, you can use the following steps:

Step 1: Check Current Kernel Version on Debian

First, you must check the current Kernel version your Debian system is using, this can be done from the command provided below:

uname -r

Step 2: Update Packages on Debian

You should also run the update command to ensure packages are updated on your Debian system:

sudo apt update && sudo apt upgrade -y

Step 3: Search for Latest Kernel Version

Now, use the apt-cache command given below to search all the packages in the package repository that has prefix “linux-image” on the Debian system:

apt-cache search linux-image

The above command will help you find the latest version of Kernel that can be installed on Debian.

Step 4: Install the Latest Kernel Version on Debian

After finding the Kernel versions, it’s now time to pick the latest one and install it on Debian through the apt install command given below:

sudo apt install linux_image_version

Note: You must replace the “linux_image-version” with the actual Kernel version number you are going to install. Here the latest one is linux-image-6.1.0-13-amd64 at the time of writing this article.

Step 5: Open Grub Configuration File

Now, you have to open the GRUB configuration file on your Debian system because this file will be responsible for booting your system. You can use the nano editor to open this file on Debian using the following command:

sudo nano /etc/default/grub

Inside the file, go to the line GRUB_DEFAULT and replace its value 0 with saved. Doing this will allow the system to use the latest selected option for boot rather than a specific menu entry:

You must save this file using CTRL+X, add Y and press Enter to exit back to the terminal.

Step 6: Update GRUB Configuration

After making changes to the GRUB configuration file, you must update GRUB on Debian to ensure that it can boot the new Kernel version. You can update the GRUB on Debian using the following command:

sudo update-grub

Step 7: Verify the Kernel Installation

To identify the position of new Kernel entry and ensure it is correctly installed on Debian system, you can use the following command:

dpkg --list | grep linux-image

Step 8: List All Available Boot Options

If you want to identify the list of all available boot option and check the position of your new Kernel entry on Debian, you can use the following command:

sudo grep 'menuentry ' $GRUB_CONFIG | cut -f 2 -d "'" | nl -v 0

Step 9: Set the Default Boot Option

You can also replace the default boot option according to your choice using the following command:

sudo grub-set-default <your_choice>

Note: You must replace <your_choice> with the number of new Kernel entry on Debian:

Step 10: Boot to New Kernel on Debian

To ensure that new Kernel version will boot up as soon as the system reboots, you can use the following command with the Kernel version entry in place of <your_choice>:

sudo grub-reboot <your_choice>

Note: The last two steps are not mandatory, however they are recommended. If you skip those steps, you have to manually select the Kernel version from the GRUB menu each time you restart the system.

Step 11: Select the Kernel from GRUB Menu

If you have skipped the previous two steps or for some reason you still won’t be able to enter the chosen Kernel, then you can manually select the Kernel from the GRUB menu. As soon as you restart your system, you will see the GRUB menu, go to the Advanced options from the list:

Choose the Kernel you want to load on your Debian system:

This will load the updated Kernel on your Debian system:

Step 12: Check Kernel Version

To ensure the updated Kernel is loaded on Debian, you can use the following command again:

uname -r

How to Install Linux Zabbly Kernel on Debian

You can also install a third-party Kernel called Linux Zabbly and update your Kernel version on Debian. The advantage of having the third-party Kernel is that you will find the latest hardware support or bug fixes. However, if you are searching for stability, you can stick with the default Debian Kernel.

If you still want to install third-party Kernel on your Debian system, you can use the following steps:

Step 1: Insta#ll Dependencies on Debian

Ensure you have a few dependencies installed on your Debian system, if not run the following command to install them:

sudo apt install lsb-release curl apt-transport-https software-properties-common ca-certificates -y

Step 2: Add Linux Zabbly Kernel GPG Key

Now, you have to add Linux Zabbly Kernel repository GPG Key to Debian using the following command:

curl -fSsL https://pkgs.zabbly.com/key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/linux-zabbly.gpg > /dev/null

Step 3: Add Linux Zabbly Kernel Repository

Then add the Linux Zabbly Kernel apt repository to Debian system using the command provided below:

codename=$(lsb_release -sc) && echo deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/linux-zabbly.gpg] https://pkgs.zabbly.com/kernel/stable $codename main | sudo tee /etc/apt/sources.list.d/linux-zabbly.list

Step 4: Update Debian Repository

After adding the Linux Zabbly Kernel repository, you must run the following command to update Debian repositories:

sudo apt update

Step 5: Install Linux Zabbly Kernel Repository on Debian

After you successfully updated the repository, you can install Linux Zabbly Kernel on Debian system through the following command:

sudo apt install linux-zabbly -y

Step 6: Load Linux Zabbly Kernel in Debian

Follow Step 10 of the above-mentioned method to load Linux Zabbly Kernel at boot on Debian:

Step 7: Check Kernel Version on Debian

Open terminal on Debian system and run the following command to ensure the system is using the Linux Zabbly Kernel:

uname -r

Conclusion

Updating your Kernel version is an important task since it helps you improve the system performance by fixing the previous bugs. You can update Kernel on the Debian system by installing the updated Kernel version from the apt repository. Then with some configuration, you have to update GRUB, this will help you select the Kernel version from the menu list. You can also install Third-party Linux Zabbly Kernel on your Debian system and update it to ensure having the latest hardware and software support. Switching to the Kernel version can also be done if there are applications that require a certain Kernel version to work on your Debian system.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.