How to remove old kernels from Debian 11

Old kernels are not immediately removed after installing a new Linux kernel. On your Debian 11, the old kernels exist in the “/boot” partition. However, you can manually delete these unused and old kernels from your system. This operation will free up disk space formerly occupied by old kernels. Some systems may become useless if the “/boot” partition does not have adequate disk space.

With this post, we will assist you in removing old kernels, which can cause future problems related to the installation of programs and packages. Before moving ahead, let’s understand some basic concepts about a Linux kernel.

Linux kernel

The Linux kernel serves as an interface between the programs and computer hardware. It is an essential part of the Linux operating system. It communicates between the processes and hardware, allowing the system to utilize resources efficiently.

What are the functions of a Linux kernel

The kernel performs these four functions:

  • Management of memory: It keeps track of how much memory is being utilized to store what and where it is stored.
  • Security and system call: Processes in your system, request services to the Linux kernel.
  • Management of processes: It also determines which processes, when, and how long they can use the CPU.
  • Device drivers: It acts as a medium interface between the hardware and the processes for communication.

Occasionally, distributions release or update a new kernel version that either addresses a bug or is the most recent version issued by the Kernel team. Debian 11 loads the new kernel when we install the latest version. As time passes, you may end up having many kernel versions, all of which take up space on your hard drive and may create future difficulties.

Now, let’s check out the method of removing the old kernel on Debian 11.

How to check current version of kernel on Debian 11

Before moving ahead to the procedure of removing old kernels from our system, we will check out our current version of the Debian kernel. To do so, we will utilize the “uname” command.

In Linux-based systems such as Debian, the “uname” command is utilized for viewing the information related to the system hardware and operating system. It also retrieves the details about the system architecture and kernel. In the “uname” command, the “-r” option is added to check the version of the kernel which we are using:

$ uname -r

You can also execute the “uname” command with the combination of “-mrs” options to get the machine name, kernel name, and its release:

$ uname -mrs

Here “x86_64” indicates that the system is booted from the 64-bit kernel:

With the “-a” option, the “uname” command reveals all of the information related to the system:

$ uname -a

How to list the installed kernels on Debian 11

After knowing the current version of the kernel, now we will execute the below-given command for getting the list of the installed kernel on Debian:

$ dpkg --list | grep linux-image

Here, the “dpkg” command with the “–list” option will extract the list of the packages installed on your Debian system. With the help of pipe operator “|” we will pass the list as input to the “grep” command. The “grep” command will look for the “linux-image” in the installed packages list. After that, it will print the output to the Debian terminal screen as follows:

How to remove old kernels from Debian 11

We have upgraded our system from Debian 10 buster to Debian 11 Bullseye and from the above-given, output you can see that the Debian 10 old kernel “linux-image-4.19.0-17-amd64” still resides on our system.

To remove old and unwanted “linux-image-4.19.0-17-amd64” kernel from Debian 11, we will execute the “remove” command with the “–purge” option. The “–purge” option will delete the specified kernel along with its configuration files:

$ sudo apt-get --purge remove linux-image-4.19.0-17-amd64

After removing the old kernel, it’s time to update the “grub2” configuration:

$ sudo update-grub2

Now, reboot your Debian 11 system:

$ sudo reboot

That’s how you remove old kernels from a Debian system.


After some time, the Linux developers team releases an update or a new kernel. All Linux-based systems such as Debian 11 keep old kernel images to be booted if a newer kernel fails. However, you can free up space held by the old kernel images. In this post, we have shown you the method of removing old kernels from your Debian 11.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.