Upgrade Linux Kernel on Debian 11

This tutorial intends to teach you to How To Upgrade Linux Kernel on Debian 11.

Linux Kernel can manage and connect and manage the resources of your Linux operating system and components. The latest stable release of the Linux kernel is version 6. You can follow this guide to see how to update your Debian Bullseye kernel version.

How To Upgrade Linux Kernel on Debian 11?

To update your Debian 11 kernel version to the latest, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Debian 11.

Now follow the steps below to complete this guide.

Step 1 – Run System Update on Debian 11

First, you need to update and upgrade your local package index on Debian 11 by using the following commands:

# sudo apt update
# sudo apt upgrade -y

By running these commands, you will be sure that all the packages are up to date.

Step 2 – How To Check Kernel Version in Debian?

At this point, you need to check your current kernel version on Debian 11. To do this, you can use the following command:

uname -r

You will get the following output:

Output
5.10.0-8-amd64

As you can see from the output, your Debian 11 current kernel version is 5.10.0-8-amd64.

Now proceed to the next steps to see how to update the Debian Bullseye kernel version to the latest.

Step 3 – Add Sid Repository on Debian 11

Sid or unstable repository is a testing repository for Debian. Here we use this repository to upgrade our Debian 11 kernel version.

To import the sid repository, run the following commands on Debian 11:

# echo "deb http://deb.debian.org/debian unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list
# echo "deb-src http://deb.debian.org/debian unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list

Step 4 – Create APT Pinning File on Debian 11

With an APT pinning file, you can receive packages from another Debian release without switching to that release.

To set up your APT pinning file, you can run the following command:

sudo tee /etc/apt/preferences<<EOF
Package: *
Pin: release a=bullseye
Pin-Priority: 500

Package: linux-image-amd64
Pin:release a=unstable
Pin-Priority: 1000

Package: *
Pin: release a=unstable
Pin-Priority: 100
EOF

Note: Remember to change the architecture of the system with yours.

You can verify your APT pinning file, by using the command below:

cat /etc/apt/preferences
Output
Package: *
Pin: release a=bullseye
Pin-Priority: 500

Package: linux-image-amd64
Pin:release a=unstable
Pin-Priority: 1000

Package: *
Pin: release a=unstable
Pin-Priority: 100

Step 5 – How To Update Kernel Version on Debian 11?

At this point, you can easily update your Linux kernel. You just need to run the system update and upgrade:

# sudo apt update
# sudo apt upgrade -y

With these commands, the new kernel image on Debian 11 will be installed.

Finally, to apply the changes, reboot the system:

reboot

Then, log in back to your server and check your kernel version with the command below:

uname -r
Output
6.1.0-9-amd64

As you can see from the output, the new kernel version 6 has been installed on your Debian 11.

Step 6 (Optional) – How To Restore Default Kernel on Debian 11?

For those who want to back to their default kernel version on their Debian 11, they can easily follow the steps below to restore their default kernel.

First, you should remove the newly installed kernel version with the following command:

sudo apt autoremove linux-image-6.1* -y

During the removal process, you will see the following message Abort kernel removal? Select No and continue.

Next, you need to remove your APT pinning file. To do this, run the command below:

sudo rm /etc/apt/preferences

Also, you need to add the new APT pinning file by using the command below:

sudo tee /etc/apt/preferences<<EOF
Package: *
Pin: release a=bullseye
Pin-Priority: 500

Package: *
Pin: release a=unstable
Pin-Priority: 100
EOF

Then, update your local package index again:

sudo apt update

Finally, install the default generic kernel on Debian 11 and reboot your system:

# sudo apt install --reinstall linux-image-generic
# reboot

Then, log in back to your server and check your kernel version with the command below:

uname -r

In your output, you should see the default Debian 11 kernel version:

Output
5.10.0-23-amd64

For more information, you can visit the Linux Kernel Documentation.

Conclusion

At this point, you have learned to Upgrade Linux Kernel on Debian 11 by using the sid repository and creating the APT pinning file to increase your system performance. If you face issues with the new kernel version, you can easily remove the new kernel version and back into your default version.

Hope you enjoy it. You can find the upgrading process of kernels in different Linux operating systems by visiting these articles:

How To Upgrade Linux Kernel on Ubuntu 22.04

How To Upgrade Linux Kernel on Centos 7

Upgrade Linux Kernel on AlmaLinux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!