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:
- How To Install PHPMyAdmin on Kali Linux
- How To Install AnyDesk on Kali Linux
- Install Atom Text Editor on Kali Linux
- How To Install Visual Studio Code on Kali Linux
Thank you great! worked for me 🙂
not working for me
E: unable to locate package linux-headers-4.0.0-kali -amd64
E: could'nt find any package by regex 'linux-headers-4.0.0.kali-amd64'
Worked like a charm. Great article. Thanks.
thank, the only page, it works
Where does it keep the header files though? I am trying to install VMWare Tools but it can't find the kernel header files.
Make sure you have the sources.list file. You can use the link.
https://computingforgeeks.com/2015/08/how-to-upgrade-to-kali-linux-20-kali.html
Then do
$ sudo apt-get update
and then
$ sudo apt-get install linux-headers-`uname -r`
nice article,it is useful to me and others to know about this items,please just keep it….
Awesome worked for me for Kali 2024.1
Nice.
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.
Sudo apt-get install linux-headers-6.1.77-v8