How to Update your Kernel in Debian
Debian is a great Linux distribution. It is stable, has a ton of packages available in the default repositories, and can run on almost anything. While it is stable and great, new version of packages can take some time before they get into the Debian repos. This is true for the kernel as well.
By default, Debian runs on a LTS (long term support) kernel, which is good for stability but it can lack some features, bug-fixes, and functionality which newer versions of the Linux Kernel has to offer.
On Debian, only one version of the kernel is available for install by default. To install another or to update kernel, we will need to enable backports. Backport packages are taken from the next, not yet released version of Debian with support for the current one.
Here in this post, I will show you how you can install a different kernel version on your Debian system and how to boot from it. Let’s get started.
First, in a terminal, type this command:
sudo nano /etc/apt/sources.list
This will open the sources.list file in nano text editor. If nano is not installed on your system, you will need to install it first via the command sudo apt install nano
.
Once there, on a new line paste this to add the backports repository:
deb http://deb.debian.org/debian buster-backports main contrib non-free
Save the file by Pressing Ctrl+o and then exit nano using Ctrl+x.
Now use this command to update the repos:
sudo apt update
If the repository was added successfully, you should see similar output from the command:
yelopanda@zerotwo:~$ sudo apt update
[sudo] password for yelopanda:
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://deb.debian.org/debian-security buster/updates InRelease
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://deb.debian.org/debian buster-backports InRelease [46.7 kB]
Get:5 http://deb.debian.org/debian buster-backports/main amd64 Packages.diff/Index [27.8 kB]
Get:6 http://deb.debian.org/debian buster-backports/main amd64 Packages 2020-10-17-0810.07.pdiff [201 B]
Get:7 http://deb.debian.org/debian buster-backports/main amd64 Packages 2020-10-18-0806.04.pdiff [1,822 B]
Get:7 http://deb.debian.org/debian buster-backports/main amd64 Packages 2020-10-18-0806.04.pdiff [1,822 B]
Fetched 128 kB in 5s (26.3 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Once it has been verified that the backport repository is up, we can go ahead and search for all the available kernel packages. To do this, type in terminal:
apt search linux-image
You should now see all the available kernel versions for your system.
Tip: 'bpo'
in the kernel name means backport.
You can now go ahead and copy the name of the kernel that you want to install. Here for this tutorial I will be selecting 5.8, which is the latest stable kernel that I can update to at the time this post was written.
It is a big jump from the kernel version 4.19 that came by default on my Debian 10 (Buster) install.
To install a new kernel, type:
sudo apt install -t buster-backports linux-image-kernel_name
I am installing kernel version linux-image-5.8.0-0.bpo.2-amd64
, so the command for me would be:
sudo apt install -t buster-backports linux-image-5.8.0-0.bpo.2-amd64
Once the kernel is installed, you can go ahead and reboot the computer.
On the bootloader screen click on Advanced options and select the new kernel version.
That it, you have successfully booted into Debian using your new kernel. Now here are some common questions that people have regarding Debian Backport kernels.
q1. How can I go back to the previous kernel version?
a. To switch to a different version of kernel, when on the grub menu and click on Advanced options. From there you can select the kernel you want to boot from.
Then when the system boots simply uninstall the kernel via the apt remove
command. Don’t forget to run sudo grub-update
to update the bootloader entries.
q. It broke something and my system is not booting, What to do?
a. Do exactly as mentioned above, boot from a different kernel, remove the one causing you problems and run grub-update
command. If a kernel is problems, chances are that you might have installed a wrong one.
There are multiple kernels types for some versions such as signed, unsigned, cloud, etc. make sure you have installed the right one.
q. Can I have multiple kernels installed at the same time?
a. Yes, you can install as many kernels as you like in Debian and boot using them using their respective bootloader entries.
Related Post: How to Install Newer Version of Packages in Debian.
Conclusion
This concludes my post on how you can update, or install the latest Kernel in Debian, thanks for reading.
Sometimes kernel change can cause issues and a few programs might refuse to work. But as discussed above, the beauty of the Debian is that you can install multiple kernel versions on a single installation. You can easily fall back to another kernel using the bootloader menu.
Share this post if you think this it was helpful and comment down below your thoughts and suggestions on this topic.
Hi,
I followed your guide on Q4OS 4.8.2-n1 (kernel 5.10.0-15-amd64) to switch to 5.10.0-0.bpo.12-amd64. Upon reboot, X would not come up automatically and I had lost my NVidia driver and config. Only available resolution was SVGA (1024×768).
How to solve?
Best,
t.
It appears, your Nvidia drivers were not installed as dkms, so they did not rebuild themselves for the new kernel. You can still boot the system using the old kernel version and install them for the new kernel using the “sudo dpkg-reconfigure *driver name*” command. Or you can also install/enable dkms for them.