How to install kernel headers on Debian

This tutorial explains how to install kernel headers on Debian 11 (Bullseye) using the apt command.

All instructions in this tutorial are also useful for other Debian-based Linux distributions such as Ubuntu.

Installing kernel headers on Debian 11:

First, update the information on your software using apt, as shown in the example below.

sudo apt update

Check for available Linux kernel headers by running the following command.

apt search linux-headers-$(uname -r)

For a different simple way to list available headers, run the command below.

sudo apt search  linux-headers

To install the Linux kernel headers, run the command shown in the screenshot below.

sudo apt install linux-headers-$(uname -r)

Using Debian 11 x64 or using the second method to find the header, you can also run the following command.

sudo apt install linux-headers-5.10.0-8-amd64

In my case, the headers were installed in the previous example, so the output says it’s already properly installed.

What is the Linux kernel?

Some experts say the kernel is the core component of an Operating System; others disagree and say the kernel is not part of the OS but a vital component needed by any OS. The function of the kernel is to manage the device resources for them to interact with the operating system and applications. We can think about the kernel as a translator allowing communication between the hardware and the software. In order to manage resources properly, the kernel has full privileges. In some cases, the installed kernel may lack the proper code to allow the hardware and software interaction; that’s when we need to install kernel headers.

What are Linux Kernel Headers?

Linux kernel headers are components usually used to compile drivers and loadable modules adding support to the kernel. For this purpose, kernel headers include C headers with functions and structures needed to compile modules. Thanks to kernel headers, modules or drivers can interact with the kernel. It is important to clarify the kernel headers are part of the kernel, despite being distributed separately.

Dealing with kernel headers is easier than dealing with whole kernel sources. If you are looking for drivers for a device, you’ll use kernel headers, while to rebuild the whole kernel, you will need whole kernel sources. By default, some Linux distributions, including Debian, include the kernel headers to be used if needed (this tutorial assumes you discarded or removed the headers). If all your hardware works properly, you probably won’t need to deal with kernel headers.


As you can see, installing Linux kernel headers on Debian or Ubuntu is pretty easy. Any Linux-level user should know the function of kernel headers and how to install them. Users must pay attention to the kernel headers they download that are compatible with their system, not only the architecture but also the version.

Thank you for reading this tutorial explaining how to install kernel headers on Debian. Keep following Linux Hint for additional Linux tips and tutorials.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.