- Kali linux which kernel
- Install Build Dependencies
- Download the Kali Linux Kernel Source Code
- Configure Your Kernel
- Build the Kernel
- Install the Modified Kernel
- What version of Debian is my Kali Linux based on?
- 4 Answers 4
- Kali and Debian
- Don’t create a FrankenDebian
- A way out with Containers
- Kali linux which kernel
- WiFi injection (Patch)
- dmesg unrestricted (sysctl)
- Privileged ports (sysctl)
- Misc (Patches)
- How To Check Kali Linux Version
Kali linux which kernel
The customizability of Kali Linux extends all the way down into the Linux kernel.
Depending on your requirements, you might want to add drivers, patches, or kernel features that are not included in the stock Kali Linux kernel. The following guide will describe how the Kali Linux kernel can be quickly modified and recompiled for your needs. Note that global wireless injection patches are already present by default in the Kali Linux kernel.
Install Build Dependencies
Start by installing all the build dependencies for recompiling the kernel:
[email protected]:~$ sudo apt install -y build-essential libncurses5-dev fakeroot xz-utils
Download the Kali Linux Kernel Source Code
The remainder of this section focuses on the 4.9 version of the Linux kernel, but the examples can, of course, be adapted to the particular version of the kernel that you want. We assume that the linux-source-4.9 binary package has been installed. Note that we install a binary package containing the upstream sources, we do not retrieve the Kali source package named linux:
[email protected]:~$ sudo apt install -y linux-source-4.9 Reading package lists. Done Building dependency tree Reading state information. Done The following additional packages will be installed: bc libreadline7 Suggested packages: libncurses-dev | ncurses-dev libqt4-dev The following NEW packages will be installed: bc libreadline7 linux-source-4.9 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 95.4 MB of archives. After this operation, 95.8 MB of additional disk space will be used. [. ] [email protected]:~$ ls /usr/src linux-config-4.9 linux-patch-4.9-rt.patch.xz linux-source-4.9.tar.xz
Notice that the package contains /usr/src/linux-source-4.9.tar.xz, a compressed archive of the kernel sources. You must extract these files in a new directory (not directly under /usr/src/, since there is no need for special permissions to compile a Linux kernel). Instead, ~/kernel/ is more appropriate:
[email protected]:~$ mkdir -p ~/kernel/ [email protected]:~$ cd ~/kernel/ [email protected]:~/kernel$ tar -xaf /usr/src/linux-source-4.9.tar.xz
Configure Your Kernel
When recompiling a more recent version of the kernel (possibly with an additional patch), the configuration will most likely be kept as close as possible to that proposed by Kali Linux. In this case, and rather than reconfiguring everything from scratch, it is sufficient to copy the /boot/config-version file (the version is that of the kernel currently used, which can be found with the uname -r command) into a .config file in the directory containing the kernel sources:
[email protected]:~/kernel$ cp /boot/config-4.9.0-kali1-amd64 ~/kernel/linux-source-4.9/.config
If you need to make changes or if you decide to reconfigure everything from scratch, you must take the time to configure your kernel. This can be done by calling the make menuconfig command:
The details of using menuconfig to set up a kernel build are beyond the scope of this guide. There is a detailed tutorial on configuring a kernel build on Linux.org.
Build the Kernel
Once the kernel configuration is ready, a simple make deb-pkg will generate up to 5 Debian packages: linux-image-version that contains the kernel image and the associated modules, linux-headers-version, which contains the header files required to build external modules, linux-firmware-image-version, which contains the firmware files needed by some drivers (this package might be missing when you build from the kernel sources provided by Debian or Kali), linux-image-version-dbg, which contains the debugging symbols for the kernel image and its modules, and linux-libc-dev, which contains headers relevant to some user-space libraries like GNU glibc. The Linux kernel image is a big build, expect it to take a while to complete:
[email protected]:~/kernel$ make clean [email protected]:~/kernel$ make deb-pkg LOCALVERSION=-custom KDEB_PKGVERSION=$(make kernelversion)-1 [. ] [email protected]:~/kernel$ ls ../*.deb ../linux-headers-4.9.0-kali1-custom_4.9.2-1_amd64.deb ../linux-image-4.9.0-kali1-custom_4.9.2-1_amd64.deb ../linux-image-4.9.0-kali1-custom-dbg_4.9.2-1_amd64.deb ../linux-libc-dev_4.9.2-1_amd64.deb
Install the Modified Kernel
When the build has successfully completed, you can go ahead and install the new custom kernel and reboot your system. Please note that the specific kernel version numbers will vary — in our example, done on a Kali 2016.2 system, it was 4.9.2. Depending on the current kernel version you’re building, you will need to adjust your commands accordingly:
[email protected]:~/kernel$ sudo dpkg -i ../linux-image-4.9.0-kali1-custom_4.9.2-1_amd64.deb [email protected]:~/kernel$ reboot
Once your system has rebooted, your new kernel should be running. If things go wrong and your kernel fails to boot successfully, you can still use the Grub menu to boot from the original stock Kali kernel and fix your issues.
Updated on: 2023-Mar-06
Author: g0tmi1k
What version of Debian is my Kali Linux based on?
I am trying to download Virtualbox on my Kali Linux and I would like know which Debian my Kali Linux is based off of. I’m not finding uname -a or cat /etc/*-release useful in this pursuit. I’m trying to install a version of Oracle’s VirtualBox which only ships for specific Debian releases. Which one should I use?
cat /etc/*-release DISTRIB_ID=Kali DISTRIB_RELEASE=2.0 DISTRIB_CODENAME=sana DISTRIB_DESCRIPTION=»Kali GNU/Linux 2.0″ PRETTY_NAME=»Kali GNU/Linux 2.0 (sana)» NAME=»Kali GNU/Linux» VERSION=»2.0 (sana)» VERSION_ID=»2.0″ ID_LIKE=debian ANSI_COLOR=»1;31″ HOME_URL=»kali.org» SUPPORT_URL=»forums.kali.org» BUG_REPORT_URL=»bugs.kali.org»
4 Answers 4
So, what’s new in Kali 2.0? There’s a new 4.0 kernel, now based on Debian Jessie
The Kali Linux distribution is based on Debian Wheezy.
But, as noted, Kali 2.0’s new 4.0 kernel is based on Debian Jessie.
From your results of uname -a , you have Kali Linux 2.0 with a kernel version of 4.0.0 , hence your kali is based on Debian Jessie.
No problem. You can follow the links provided on this page for more information. In particular, you can look at kali linux 2.0 released for Kali 2.0, which is what you have.
Kali and Debian
Kali has detailed this in their blog post «Kali’s Relationship With Debian».
The Kali Linux distribution is based on Debian Testing. Therefore, most of the Kali packages are imported, as-is, from the Debian repositories. In some cases, newer packages may be imported from Debian Unstable or Debian Experimental, either to improve user experience, or to incorporate needed bug fixes.
Debian testing is the current development state of the next stable Debian distribution. It is also made available under the code name of the next stable release, Bullseye is the current testing codename.
So in short, they’re not based on A Debian Release. Like Ubuntu and many others, Kali does source their packages from Debian.
Don’t create a FrankenDebian
What you’re wanting to do is what we call making a «FrankenDebian». Because Debian Testing is rolling any version of it will be different from any released or frozen version of Debian. So the question amounts to more or less,
At the time I’m doing this what release of Debian is closest to the release that Kali took when they froze Debian Testing.
That’s going to be very contemporary,
- if Kali sourced testing after Debian froze testing and made a release then Kali may have a newer version than any released version of Debian.
- if Kali sourced testing before Debian froze testing and made a release then they’re going to likely have an older version of said things.
This is will not be good for you either way.
A way out with Containers
A better idea is to simply use Debian Stable (which Oracle supports) and run Kali in a container. You can find information on the Kali site about using their Docker or LXC/LXD images.
Kali linux which kernel
The Kali Linux kernel differs slightly from the “usual” kernel. For the purposes of penetration testing, we chose to use some defaults that differ from general-purpose Linux distributions, and we also patch the kernel here and there. This page will document these changes.
Default values can be modified via the tool kali-tweaks , but patches can’t be undone without generating a new kernel.
Beside each header will call out if the configuration is a kernel patch or if the behavior was modified by sysctl. If you would like to explore these kernel patches for yourself, you can find them here, on our GitLab.
WiFi injection (Patch)
We supply a WiFi injection patch to help with WiFi-based penetration testing.
dmesg unrestricted (sysctl)
The kernel logs are unrestricted by default, meaning that any unprivileged user can run the command dmesg and inspect the kernel logs (also called the “kernel ring buffer”). If you would prefer dmesg to remain a privileged command, you can use kali-tweaks to restore this behavior.
Privileged ports (sysctl)
Traditionally, IPv4 ports below 1024 are called “privileged ports,” and can only be used by the privileged user. In Kali Linux, this is disabled by default, meaning that all ports are “unprivileged,” or in other words any user can run a program that binds to any port, even below 1024.
This was done as Kali is no longer root user by default, and with a non-root user some tools, such as netcat or Metasploit, may be trying to use ports that would require privilege. This should cut-down on the need to run sudo as often. If you would like to leave ports 1024 and below as privileged, this can be done through kali-tweaks .
Misc (Patches)
How To Check Kali Linux Version
There are many methods of knowing the version of Kali Linux that you are running on your machine. Here I have selected 5 ways to check the Version of Kali Linux you are running using Terminal, how to know the Linux Kernel you are running, the Release of the Kali host machine, Architecture of the host machine and the Kali Linux Codename among other things about your Kali OS.
Note that Linux and generally UNIX-based systems are Case Sensitive. This simply means that different-case letters have different meaning. Small-case letters in UNIX have totally different roles or functions in Terminal. A good example is the letter ‘v” and ‘V’. The letter ‘-v’ is popularly known for its usage to imply ‘verbose’ while ‘-V’ is popularly known for its usage to imply “Version”, used as an alias to ‘–version’.
For all commands, open Terminal and enter the following commands ‘as is’:
root@kali:~# cat /etc/os-release
root@kali:~# cat /etc/os-release
PRETTY_NAME=”Kali GNU/Linux Rolling”
NAME=”Kali GNU/Linux”
ID=kali
VERSION=”2019.3″
VERSION_ID=”2019.3″
VERSION_CODENAME=”kali-rolling”
ID_LIKE=debian
ANSI_COLOR=”1;31″
HOME_URL=”https://www.kali.org/”
SUPPORT_URL=”https://forums.kali.org/”
BUG_REPORT_URL=”https://bugs.kali.org/”
root@kali:~# hostnamectl
Static hostname: kali
Pretty hostname: kali
Icon name: computer-laptop
Chassis: laptop
Machine ID: rw48t8h09009237y83y98y94rf7403i5
Boot ID: nh67t87242hdr78y92802082uo320u34
Operating System: Kali GNU/Linux Rolling
Kernel: Linux 5.2.0-kali2-amd64
Architecture: x86-64
root@kali:~# cat /etc/issue
Kali GNU/Linux Rolling \n \l
root@kali:~# lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.3
Codename: kali-rolling
root@kali:~# uname -srm
Linux 5.2.0-kali2-amd64 x86_64
SUPPORT [[:thetqweb:]] VIA