How to Upgrade Kernel on Debian 12?


The kernel is the important part of the operating system that manages the hardware as well as software interactions/resources (depending on your preferences). By upgrading the kernel, users can benefit from the latest features, bug fixes, and patches that are available for their Linux systems such as Debian 12.

This article will show possible methods to upgrade the kernel on Debian 12. Also, explain how to check your current kernel version, how to remove old kernels, and how to troubleshoot any issues that might arise during the upgrade process.

How to Upgrade Kernel on Debian 12?

Before you proceed, make sure that your operating system is updated and have a copy/backup of data. To upgrade the kernel on Debian 12, use the below methods:

Method 1: Using Official Debian Repository

Method 2: Using a Third-Party Repository

Let’s begin with the first one.

Method 1: Upgrade Kernel on Debian 12 Using the Official Debian Repository

Upgrading the kernel can improve your Debian system’s performance, security, and stability. To upgrade the kernel on Debian 12 via the official Debian repositories, follow these steps:

Step 1: Check the Current Kernel Version

To check the existing kernel version, use the “uname” with the “r” option. It displays the current “6.1.0-17-amd64” kernel version:

uname -r

Step 2: List Available Kernel Packages

To list all (available) kernel packages from the Debian repositories, use the “apt-cache” command with the “search” utility by specifying the “linux-image” (package name):

apt-cache search linux-image

Step 3: Install Kernel Package (Default Version)

If users have a 64-bit system and want to install the latest stable kernel, choose the “linux-image-amd64” package (that suits system architecture and needs):

sudo apt install linux-image-amd64

Note: The user can replace “linux-image-amd64” with the chosen package name.

Install Specific Kernel Version (Latest Package)

To install the latest kernel version on Debian 12, specify the kernel package name. In our case, the recent release of kernel version is “6.1.0-18”:

sudo apt install linux-image-6.1.0-18-amd64

Step 4: Reboot System

To apply the changes and load the new kernel, reboot the system with the below command:

sudo reboot

It automatically boots the latest version of Kernel on Debian 12:

Note: If the GRUB menu is not found, then, press and hold the Shift key or hit the escape key repeatedly (for UEFI). It opens the menu. Now, select “Advanced option” and pick the specific Kernel version for booting.

Step 5: Verify Kernel Version

Finally, users can verify the new upgraded kernel version using the “uname” command with the “r” option:

uname -r

You have successfully upgraded the kernel from “6.1.0-17-amd64” to “6.1.0-18-amd64” on Debian 12 using the official Debian repositories.

Note: Users can enlist the available packages using “dpkg –list | grep linux-image” command.

Optional: Remove Kernel Old Version

To remove the old kernel version on Debian 12, use the “apt autoremove” command by specifying the kernel package name:

sudo apt purge linux-image-[version-number]*

Note: However, upgrading the kernel also involves some risks, such as breaking existing drivers, applications, or configurations. Therefore, it is important to weigh the pros and cons of upgrading the kernel before proceeding with the process.

Method 2: Upgrade Kernel on Debian 12 Using Third-Party Repository

Upgrading the kernel on Debian 12 can be done using a third-party repository. It provides newer versions of the Linux kernel (such as Liquorix Kernel, XanMod Kernel and Zabbly Kernel). In our case, install the Liquorix kernel on Debian 12.

To upgrade/install the Liquorix kernel using a third-party repository, follow these steps:

Step 1: Update Package Lists

First, update as well as upgrade the system package lists. It is possible with the apt command:

sudo apt update && sudo apt upgrade

Step 2: Install Dependencies (Required Packages)

To install the dependent packages before installing the latest kernel on Debian 12, use the below command:

sudo apt install lsb-release curl apt-transport-https

Step 3: Install Liquorix Kernel

Now, install the latest kernel from the Liquorix repository. You can choose between different kernel flavors, such as Liquorix, Zabbly, or XanMod. In our case, install Liquorix Kernel on Debian 12 by downloading the script file from official website:

curl 'https://liquorix.net/add-liquorix-repo.sh' | sudo bash

Step 4: Reboot System

To apply the changes and load the new kernel, reboot the system with the following command:

sudo reboot

It automatically boot the Liquorix Kernel with the latest version on Debian 12:

Step 5: Check Kernel Version

After rebooting the system, check the upgraded kernel version by running the “uname” command with the “r” utility:

uname -r

Alternatively, use the “hostnamectl” command to get the complete information of the operating system (including kernel version):

Fix 1: Update GRUB Configuration

If the user finds any issue, update the grub configuration via the “sudo update-grub” command.

Fix 2: Select Kernel Using Boot Menu

Users can also select the new kernel from the boot menu by hitting the “Advanced options”:

After that, select the kernel based on their need:

Tip 1: Set Default Kernel Version on Debian

Debian provides the “grub-set-default” command. To set/change the default kernel version on system, specify the kernel version:

sudo grub-set-default kernel_version

Tip 2: Switch/Change Between Different Kernel Versions

For changing the default Kernel, set the default kernel version by editing the “/etc/default/grub” file and changing the “GRUB_DEFAULT” value to the name or index of the kernel version you want.

Optional: Remove APT Repository (Liquorix Kernel)

To remove the apt repository from the source list, use the “rm” command by specifying the installed path as below:

sudo rm /etc/apt/sources.list.d/liquorix.list

Remove the Liquorix Kernel

User can remove the kernel package along with all dependencies by specifying the package name:

sudo apt autoremove linux-image-*.*.*-liquorix-amd64 linux-headers-*.*.*-liquorix-amd64 --purge

Conclusion

Upgrading the kernel on Debian 12 is an effective solution to enhance the security, performance, and stability of the system. To upgrade the kernel on Debian 12, use the official Debian repository or third-party repository (Installing Liquorix Kernel). It offers the benefits of the newest features and fixes, as well as avoiding potential issues and vulnerabilities.

To get the latest Kernels versions on the Debian system, execute the “sudo apt-cache search linux-image” command. To set the Kernel version (default) on Debian 12, use “sudo grub-set-default <kernel-version>”.

This guide has explained all possible methods to upgrade the kernel on Debian 12.

Categories