Over the last few weeks, I’ve gone through the process of installing Kali onto its own microSD card for use on the pi-top. I started with the latest 2017 image, but recently the first 2018 image became available, so I did the procedure again. This document will cover the latest image.
First, I downloaded the image from the site onto my Linux Mint laptop. Next, I verified the checksum.
This matched the checksum on the site. After verification, I unpacked the xz archive with unxz. This created the kali-linux-2018.1-rpi3-nexmon.img image file for installation.
Next, I put a new 32G microSD card in to receive the image. I checked dmesg output to verify that the card was recognized successfully.
[11115.585761] mmc0: new ultra high speed SDR50 SDHC card at address 0001
[11115.603234] mmcblk0: mmc0:0001 00000 29.8 GiB
[11115.606945] mmcblk0: p1
In order to install, I unmounted the auto-mounted card and used dd to tranfer a copy of the image to the card.
sudo dd if=./kali-linux-2018.1-rpi3-nexmon.img of=/dev/mmcblk0 bs=512k
14000+0 records in
14000+0 records out
7340032000 bytes (7.3 GB, 6.8 GiB) copied, 388.375 s, 18.9 MB/s
I ejected and re-inserted the card to verify it is seen correctly. Both partitions were picked up, and I unmounted these for the next step. Because the image is much smaller than the size of the card, I needed to resize the linux partition to take advantage of the extra space. I used GParted for this.
GParted has an issue with the e2fsck not being up to date enough. I had to install the following two packages manually, before growing the EXT4 mount point:
sudo apt-get install ./e2fsprogs_1.43.8-1ubuntu1_amd64.deb ./e2fslibs_1.43.8-1ubuntu1_amd64.deb
Once GParted was working correctly, I used it to resize the linux partiton.
sudo gparted /dev/mmcblk0
I selected the EXT4 mount, chose “move/resize,” and resized it to take up all of the unallocated space. I then applied the change, and closed the program.
I swapped microSD cards to put Kali into the pi-top and remove polarisOS. Booting the machine worked fine on first try, so the image appears to be installed okay.
I had a few housekeeping tasks to take care of.
My first housekeeping task was to create a new password for the root user. Second was to regenerate host keys. Most pre-built images should go through these two basic steps, since they ship with pre-generated widely known shared keys and passwords.
To regenerate the host keys, I ran:
root@kali:~ rm /etc/ssh/ssh_host_*
root@kali:~ dpkg-reconfigure openssh-server
root@kali:~ service ssh restart
I was surprised to find that the newest version of kali actually didn’t ship with pre-installed ssh host keys. When I ran the rm command, it failed with file not found, and a file listing of /etc/ssh confirmed there were none to remove. I only needed the dpkg-reconfigure and service restart.
My next steps included updating the system, since Kali-Rolling updates very frequently. In order to do this, I put the machine on the network, then ran the following:
The reason for the ntpdate first is that the machine doesn’t come with a configured NTP service, and the clock on the Pi puts the machine several months behind the real world. It thought it was December 14 rather than current date. The other two commands updated the APT cache, and then updated the system to latest.
My final task was to go through the process of updating the repository lists to be able to install the “pt-*” packages from polarisOS, but I ran into a dependency error on one of the packages, which prevented that from working properly. I’ll continue to troubleshoot this issue before I go into the deep details of setting it up, but the error I ran into was that the python3-pt-idletime package was dependent upon python3 (< 3.6) where 3.6.4 is the current version in Kali.