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 –
|# OFFICIAL DEBIAN REPOS|
|###### Debian Main Repos ######|
|deb http://deb.debian.org stable main contrib|
|deb-src http://deb.debian.org stable main contrib|
|deb http://deb.debian.org stable-updates main contrib|
|deb-src http://deb.debian.org stable-updates main contrib|
|deb http://deb.debian.org/debian-secruity stable/updates main|
|deb-src http://deb.debian.org/debian-secruity stable/updates main|
|deb http://ftp.debian.org/debian jessie-backports main|
|deb-src http://ftp.debian.org/debian jessie-backports main|
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.
|[$] aptitude search linux-image|
|p linux-image-4.10.0-rc6-686:i386 – Linux 4.10-rc6 for older PCs (signed)|
|p linux-image-4.10.0-rc6-686-dbgsym:i386 – Debug symbols for linux-image-4.10.0-rc6-686|
|p linux-image-4.10.0-rc6-686-pae:i386 – Linux 4.10-rc6 for modern PCs (signed)|
|p linux-image-4.10.0-rc6-686-pae-dbgsym:i386 – Debug symbols for linux-image-4.10.0-rc6-686-pae|
|p linux-image-4.10.0-rc6-686-pae-unsigned:i386 – Linux 4.10-rc6 for modern PCs|
|p linux-image-4.10.0-rc6-686-unsigned:i386 – Linux 4.10-rc6 for older PCs|
|p linux-image-4.10.0-rc6-amd64 – Linux 4.10-rc6 for 64-bit PCs (signed)|
|p linux-image-4.10.0-rc6-amd64-dbgsym – Debug symbols for linux-image-4.10.0-rc6-amd64|
|p linux-image-4.10.0-rc6-amd64-unsigned – Linux 4.10-rc6 for 64-bit PCs|
|v linux-image-4.10.0-trunk-686:i386 –|
|p linux-image-4.10.0-trunk-686-dbgsym:i386 – Debug symbols for linux-image-4.10.0-trunk-686|
|v linux-image-4.10.0-trunk-686-pae:i386 –|
|p linux-image-4.10.0-trunk-686-pae-dbgsym:i386 – Debug symbols for linux-image-4.10.0-trunk-686-pae|
|p linux-image-4.10.0-trunk-686-pae-unsigned:i386 – Linux 4.10 for modern PCs|
|p linux-image-4.10.0-trunk-686-unsigned:i386 – Linux 4.10 for older PCs|
|v linux-image-4.10.0-trunk-amd64 –|
|p linux-image-4.10.0-trunk-amd64-dbgsym – Debug symbols for linux-image-4.10.0-trunk-amd64|
|p linux-image-4.10.0-trunk-amd64-unsigned – Linux 4.10 for 64-bit PCs|
|p linux-image-4.9.0-2-686:i386 – Linux 4.9 for older PCs (signed)|
|p linux-image-4.9.0-2-686-dbgsym:i386 – Debug symbols for linux-image-4.9.0-2-686|
|p linux-image-4.9.0-2-686-pae:i386 – Linux 4.9 for modern PCs (signed)|
|p linux-image-4.9.0-2-686-pae-dbgsym:i386 – Debug symbols for linux-image-4.9.0-2-686-pae|
|p linux-image-4.9.0-2-686-pae-unsigned:i386 – Linux 4.9 for modern PCs|
|p linux-image-4.9.0-2-686-unsigned:i386 – Linux 4.9 for older PCs|
|i A linux-image-4.9.0-2-amd64 – Linux 4.9 for 64-bit PCs (signed)|
|p linux-image-4.9.0-2-amd64-dbgsym – Debug symbols for linux-image-4.9.0-2-amd64|
|p linux-image-4.9.0-2-amd64-unsigned – Linux 4.9 for 64-bit PCs|
|p linux-image-4.9.0-2-grsec-686-pae:i386 – Linux 4.9 for modern PCs, Grsecurity protection|
|p linux-image-4.9.0-2-grsec-amd64 – Linux 4.9 for 64-bit PCs, Grsecurity protection|
|p linux-image-4.9.0-2-rt-686-pae:i386 – Linux 4.9 for modern PCs, PREEMPT_RT (signed)|
|p linux-image-4.9.0-2-rt-686-pae-dbgsym:i386 – Debug symbols for linux-image-4.9.0-2-rt-686-pae|
|p linux-image-4.9.0-2-rt-686-pae-unsigned:i386 – Linux 4.9 for modern PCs, PREEMPT_RT|
|p linux-image-4.9.0-2-rt-amd64 – Linux 4.9 for 64-bit PCs, PREEMPT_RT (signed)|
|p linux-image-4.9.0-2-rt-amd64-dbgsym – Debug symbols for linux-image-4.9.0-2-rt-amd64|
|p linux-image-4.9.0-2-rt-amd64-unsigned – Linux 4.9 for 64-bit PCs, PREEMPT_RT|
|p linux-image-586:i386 – Linux for older PCs (dummy package)|
|p linux-image-686:i386 – Linux for older PCs (meta-package)|
|p linux-image-686-dbgsym:i386 – Debug symbols for Linux 686 configuration (meta-package)|
|p linux-image-686-pae:i386 – Linux for modern PCs (meta-package)|
|p linux-image-686-pae-dbgsym:i386 – Debug symbols for Linux 686-pae configuration (meta-package)|
|i linux-image-amd64 – Linux for 64-bit PCs (meta-package)|
|p linux-image-amd64-dbgsym – Debug symbols for Linux amd64 configuration (meta-package)|
|p linux-image-grsec-686-pae:i386 – Linux image meta-package, grsec featureset|
|p linux-image-grsec-amd64 – Linux image meta-package, grsec featureset|
|p linux-image-grsec-i386:i386 – Linux image meta-package, grsec featureset (transition package)|
|p linux-image-rt-686-pae:i386 – Linux for modern PCs (meta-package), PREEMPT_RT|
|p linux-image-rt-686-pae-dbgsym:i386 – Debug symbols for Linux rt-686-pae configuration (meta-package)|
|p linux-image-rt-amd64 – Linux for 64-bit PCs (meta-package), PREEMPT_RT|
|p linux-image-rt-amd64-dbgsym – Debug symbols for Linux rt-amd64 configuration (meta-package)|
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.