Welcome to our article on How to install Linux Kernel Headers on Kali Linux. If you just installed or upgraded to Kali Linux 2024.x and would like install Kernel headers, then this guide is for you?. In our previous article, we talked about how to Install Kali Linux – Step by Step. When you install new Kali Linux, it doesn’t come with Linux kernel headers out of the box and you’ll have to install them manually, the easiest way to do that will be explained shortly.

The need for Linux headers?

Kernel header files in the Linux kernel are used for two purposes:

  • To define interfaces between components of the kernel, and
  • To define interfaces between the kernel and userspace

Linux headers are needed for building modules that load into the kernel provided by the Linux kernel. When you need to run virtual machines using hypervisors such as Virtualbox and VMware Workstation on Kali Linux, it will require you to have Linux kernel headers installed.

Install Linux Kernel Headers on Kali Linux

Follow the following short tutorial on how to install Linux kernel headers. If you are on Kali Linux, make sure you have the following repositories on your sources.list file:

$ sudo vim /etc/apt/sources.list
deb http://http.kali.org/kali kali-rolling main contrib non-free

OR

$ sudo nano /etc/apt/sources.list
deb http://http.kali.org/kali kali-rolling main contrib non-free

Update apt-cache and upgrade

Once the packages repo is updated, upgrade your system

sudo apt update
sudo apt upgrade -y

After that, reboot the system:

sudo reboot

Wait for it to come online then check your kernel version by typing:

$ uname -r
5.14.0-kali4-amd64

Install kernel headers on Kali Linux

To install kernel headers, run the command:

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

Accept installation prompts that comes after running the command:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
....
  linux-compiler-gcc-10-x86 linux-headers-5.14.0-kali4-amd64 linux-headers-5.14.0-kali4-common linux-kbuild-5.14
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.8 MB of archives.
After this operation, 61.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

You can also append kernel version to Linux-headers command.For example

sudo apt-get install linux-headers-<version>

That’s all about how one can install Linux Kernel Headers on Kali Linux. Let me know in case you encounter any issues. I’ll be happy to help where possible. Below are more guides available on our website:

12 COMMENTS

  1. nice article,it is useful to me and others to know about this items,please just keep it….

  2. Not working for me on the raspberry pi 5.

    E: Unable to locate package linux-headers-6.1.77-v8
    E: Couldn’t find any package by glob ‘linux-headers-6.1.77-v8’

    Need them in order to install the wifi drivers for my wifi dongle.

LEAVE A REPLY

Please enter your comment!
Please enter your name here