Managing Linux Kernel Upgrades In Debian
Brief: This article explains the steps to upgrade Linux kernel in Debian. It also provides you a few tips and some trivia around kernel management in Debian Linux.
While upgrading Linux Kernel in Ubuntu is slightly easier thanks to some graphical tool, I as a Debian user prefer to set things right in the terminal instead of in GUI. Before we see how to upgrade Linux kernel in Debian, let’s see a few things about it first.
The Debian LTS kernel Initiative
Now the Linux kernel is an ever-moving target. Roughly every four months Linus releases a new kernel. Four months is a pretty short time to catch all the regressions and add new features etc. and hence . in 2011, a number of electronic makers came together and the LTSI initiative was born.
The reason I shared the above is, at least in Debian, the Debian kernel maintainers always try to stick to the LTSI release in the stable release. The reasoning is simple, you get two years maintenance from upstream kernel which is similar to Redhat and Canonical’s Ubuntu. Debian also provides security support for 5 years for the Debian kernel plus apps and they have been somewhat successful in raising the required amount although it never can be enough.
Who really needs a new kernel?
There are only 2-3 types of people or people thrown into situations where a kernel upgrade will benefit.
- Have the latest hardware – While both chip manufacturers nowadays send code and driver contributions around 6 months before release, the userspace tools would need more time to be optimized and know the system a bit more intimately. For e.g. if I were to a Kaby Lake processor or a Zen processor then having the latest kernels will at the very least make sure you have a CLI (command-line interface) if not the GUI.
- Regression – At times, mistakes do happen which are called regressions. These regressions over-time are and can be expensive to an organization. This has been discussed and known over the years and the only way to do that is have more and more users testing the kernels and having a variety of kernels in real-world conditions. In reality, most people do not even know that the kernel has a performance regression unless there is a specific use-case and there are other kernel versions doing the same/similar work with the same specs.
- Formatting a system to start things from scratch – Whenever you format your system it makes most sense to use the latest available kernel
How to know Linux Kernel version in Debian Linux?
Before we go anywhere or do anything, we need to know what is the version of the existing kernel. You can use the command below:
The output of the above command for my system is 4.9.0-2-amd64 meaning that I use Linux Kernel 4.9.0-2.
Using backport Linux kernels in Debian
Now if I were on Debian Jessie, what is called as the “stable” in Debian for 64-bit systems (as that’s in vogue now) – I would be using 3.16.0-4. Now let’s say for one or the reason from the above, you want the backported kernel. Now the only thing you need to do is to add backports to the list of /etc/apt/sources.list . Here is an example of an /etc/apt/sources.list using stable –
Do that and run
sudo aptitude update
Look for available Linux Kernel
Once the index is updated, you can do –
aptitude search linux-image
It should give you a list containing your existing kernel as well as any new kernel images its finds. Mine is a bit differently tailored /etc/apt/sources.list hence gives slightly different results.
As you can see, the linux-image commanded also showed the 32-bit kernels because I have added architecture-i386 as a foreign architecture.
Installing a new Linux Kernel in Debian
Now usually if people want to update, they simply update linux-image-amd64 and it will pull in the required dependencies.
In my case, however, as there are no kernel updates in the short-term I will show how to update/upgrade to the next kernel, in this case 4.10.0-trunk. So this is what I do:
sudo aptitude install linux-image-4.10.0-trunk-amd64-unsigned linux-headers-4.10.0-trunk-amd64
Just follow the instructions. If something goes wrong, you’ll still be on the old kernel. However, I would insist that you file a bug report to Debian developers.
I hope you know how to upgrade Linux kernel in Debian and you also learned a few things about Linux kernel. As I love using Debian, I’ll write more articles around it in coming weeks.