Kali Linux on the Raspberry Pi: 3, 2, 1, and Zero

Combining two of my favorite things: Kali Linux and variety of Raspberry Pi models.

This promises to be great fun! I'm going to be combining two of my favorite things: Kali GNU/Linux software and various models of Raspberry Pi hardware. I have been looking forward to doing this since I first heard that there was a Kali Linux installation image for the Raspberry Pi.

Photos of the Raspberry Pi through the ages: From the prototype to Pi 3

A walkthrough of every model of the Raspberry Pi to be released dating back to an early prototype in 2006.

Read More

The general information about Kali Linux for the Raspberry Pi is included in the Kali Linux Official Documentation. It describes two general concepts of putting Kali on a Pi, either using a pre-built installation image, or by creating a custom build. I will stick to the pre-built version for the time being, but I am sorely tempted to make a custom build of Kali with the i3 desktop for the Raspberry Pi.

If all goes well with the pre-built installation, I am very likely to do that.

The installation images are available on the Offensive Security ARM Images Downloads area, where you will find custom images not only for the Raspberry Pi, but for a variety of other ARM SBC systems (Beaglebone, BananaPi, etc.) and even ARM-powered Chromebooks from HP, Samsung and Acer. The really exciting news for me, though, is that there are images not only for the Pi 2/3, but also for the original Pi.

There is even a pre-built custom image for the Pi with TFT display. I am assuming this means the "official" 7-inch display, which I have been wanting to get for quite a while. So if everything goes well in this first phase, there's another load of fun waiting in a follow-up.

The download files are xz-compressed images, the Pi 2/3 image is about 1.5GB and the Pi 1/Zero image is about 1.1GB. The installation requires at least an 8GB SD card. The image can be uncompressed and copied to the card using the same command this I gave in the previous Pi/Linux articles:

xz -cd kali-2.1.2-rpi2.img.xz | dd of=/dev/sdb bs=4M iflag=fullblock oflag=direct status=progress

This creates a 60MB FAT16 boot partition and a 6.8GB ext4 root partition. The root partition does not get enlarged by the initial setup sequence, so if you want it to fill the available space on the SD card, it's just as well to do it manually at this point. On an 8GB microSD card, I was able to extend it to 7.25GB.

After copying the image to the card I simply inserted it in a Raspberry Pi 2 and powered it up. It booted and started a login window for the Xfce desktop. Logging in with the default Kali credentials then gave me this:

Kali Linux Pi

Kali Linux Raspberry Pi 2/3 (Xfce 4.12)

Image: J.A. Watson

Wow! How good is that!!! That is, in fact, the same desktop that I got a year ago, when I wrote about Kali Linux Light. The Raspberry Pi 3 hardware was recognized and working, including the wired network connection and the built-in WiFi adapter, as was my Logitech Unifying keyboard and mouse.

At this point it was running Linux kernel 4.1.19, and said that it was Kali Linux 2016.1. The current Kali release is 2016.2, so I ran apt-get update; apt-get dist-upgrade. That produced a long list of updates and new packages to install (roughly 780). Installing the updates took a good bit of time, but was nowhere near as slow as Ubuntu MATE updates, for comparison. In less than an hour the download, installation and reboot were done and the system says that it is now running Kali Linux 2016.2.

The next step was to shut down the Raspberry Pi 3, and try this microSD card in a Pi 2. That also worked without problem, and I honestly did not even notice a significant difference in speed of the boot and login processing. The official Pi USB WiFi adapter was recognized as well, so I could connect either wired or wireless networking.

With Kali Linux on the Pi 2 and 3 working nicely, it was time for another major test - the "original" Raspberry Pi family, now generally called Pi 1, with the Model A/A+/B/B+ and Zero. It has its own installation image, which I downloaded and copied to another microSD card.

xz -cd kali-2.1.2-rpi.img.xz | dd of=/dev/sdb bs=4M iflag=fullblock oflag=direct status=progress

I put that microSD card into my Raspberry Pi Model B+, powered it up, and... much more slowly that the Pi 2/3, it booted! The login screen seems not to have the background image that the Pi 2/3 version had, it is just black with the login window in the center, but it works. After entering the login credentials, the initial processing to bring up the desktop took a really, really long time. But it worked, and I ended up with exactly the same desktop as the Pi 2/3 had.

As with the Pi 2, both the wired ethernet connection and the USB WiFi adapter worked, so I could get connected to the internet. Once the desktop is ready the only thing that seems really painfully slow is opening a new application. Once something is up and running, performance is quite acceptable.

Ok, the final test... take that microSD card out of the B+ and put it into a Zero. Yes, I know that this should be a no-brainer because the Zero is functionally identical to the B+. But in this case, seeing is believing.

I used my original Pi Zero (v1.2) for this test. Insert the card, connect power... and it comes right up, just like the B+ did! Hooray! This is just insanely good! Seriously, after the amount of trouble I had trying out various other Linux distributions on the Raspberry Pi, and the amount of time that took, I was really not expecting Kali Linux on the Pi to be a walk in the park - but that is really what it has turned out to be.

Finally, I mentioned above that I would like to have an i3 desktop version of Kali for the Raspberry Pi. Unfortunately i3 is not in the Kali ARM repositories, so I can't take the easy way out and just download it. Fortunately, I still have a very nice mail that was sent to me by one of the Kali developers after my post last year, which explains their "live-build" scripts. These can be used to build a customized version of Kali, so I will be giving that a try soon!

Read more about Linux and the Raspberry Pi