A few folks have been trying to get Kali Linux, a Debian-derived Linux distribution designed for digital forensics and penetration testing, to run on ESXi-Arm. Similiar to Raspberry Pi OS, the techniques outlined in this blog post can be used to convert the image-based system to a Virtual Machine that ESXi-Arm can then run natively. However, there is an issue when attempting to install grub during Step 16 where it can not locate an EFI partition.
With the help of Cyprien Laplace, we can now run Kali Linux on ESXi-Arm! You can find the detailed instructions below including installing VMware Tools for Kali Linux running on ESXi-Arm.
UPDATE (03/29/21): At the time of writing this blog post, Kali 2020.4 was the latest version and these instructions have been verified using that version. As of 02/24/21, Kali has released an ISO version of Kali Linux 2021.4 which is for the Apple M1, but it also works on ESXi-Arm as shared by one of our ESXi-Arm Engineers. You can now install Kali without having to go through this process and the steps below are no longer applicable. VMware Tools can also be installed on Kali Linux, for detailed instructions, please see this blog post.
If you want to run Kali 2021.1 on @esxi_arm, you can just download the ISOs "For Apple M1", it will work out-of-the-box 😲 https://t.co/6SYjHUlwIl
— Cypou (@cypou) March 29, 2021
Step 1 - You need access to a system that has the qemu-img utility installed. In my setup, I am MacOS and you can install qemu-img using brew. You will also need about ~10GB of free storage for the converted file format.
Step 2 - Download the latest Kali Linux RaspberryPi 2 (v1.2), 3 and 4 (64-Bit) image to your system and extract the file using the following command:
gunzip kali-linux-2020.4-rpi4-nexmon-64.img.xz
Step 3 - Use qemu-img to convert the image file to a VMDK
qemu-img convert -f raw kali-linux-2020.4-rpi4-nexmon-64.img -O vmdk kali-linux-2020.4-rpi4-nexmon-64.vmdk
Step 4 - SCP the VMDK file to the datastore of your ESXi-Arm host
Step 5 - We need to actually convert the VMDK one more time so ESXi understands it, as the qemu-img utility only converts it to a hosted format which is normally used by Workstation/Fusion. To do so, we just use our good ol' friend, vmkfstools. You need to SSH (SSH is disabled by default) to the ESXi-Arm host after SCP'ing the VMDK and then run this command from ESXi-Arm host:
vmkfstools -i kali-linux-2020.4-rpi4-nexmon-64.vmdk -d thin kali-2020.4.vmdk
After the conversion completes, you can delete the source VMDK.
Step 6 - Download the latest Debian 10.x Arm Network Installer ISO and also upload that to the datastore of your ESXi-Arm host
Step 7 - Create a New VM called kali-2020.4 with the following configuration:
Compatibility: ESXi 7.0 and laterGuest OS Family: LinuxGuest OS Version: Debian GNU/Linux 11 (64-Bit)CPU: 2 (or desired value)MEM: 2GB (or desired value)Hard Disk 1: Remove default since we are going to attach the one we just converted. To so by clicking on "Add New Device" and select Existing Hard Disk and locate that on the ESXi-Arm datastoreCD/DVD dive 1: Select Datastore ISO File and locate the Debian Network Installer ISO from ESXi-Arm Datastore and ensure the device has checked box for "Connected" and "Connect at power on"
Step 8 - Edit the VM and increase the size of the VMDK. This is required to properly setup Kali but it will also be useful if you intend to do something useful with it afterwards 🙂 In my setup, I increased it to 16GB.
Note: At this point, it is highly recommended to create an offline snapshot in case you mess up and can easily revert before you have powered on the VM.
Step 9 - Power on the VM and in then select Advanced options from the GRUB menu
Step 10 - Next, select Rescue Mode
Step 11 - Complete the basic setup screen (language, country, keyboard, hostname, domain and timezone) before we can boot into rescue mode.
Step 12 - Select /dev/sda2 to boot from
Step 13 - Go ahead select Yes to mount /boot as a separate partition.
Step 14 - Select the Execute a shell in /dev/sda2 and you will be prompted once more, hit continue.
Step 15 - We now need to resize our partition, run the following command which will bring up an interactive console. Select /dev/sda2 and then select the Resize option below and then hit enter. Quit to exit the utility.
cfdisk /dev/sda
Step 16 - Next, we need to resize the filesystem by running the following command:
resize2fs /dev/sda2
Step 17 - Now we need to update the /etc/fstab file so that it points to the correct disk partitions. Replace the second line in the file with /dev/sda1 and the new mount point will be /boot/efi and replace the third line in the file with /dev/sda2 and mount point will be / as shown in the screenshot below.
Step 18 - Create and mount the EFI boot directory by running the following two commands:
mkdir -p /boot/efi && mount /boot/efi
mv /boot/efi/* /boot
At this point, you are now ready to install grub.
Step 19 - Run the following command to pull latest updates and install Grub packages for Arm:
apt update
apt install -y linux-image-arm64 grub-efi-arm64
Step 20 -Run the following command to install Grub onto our Kali image:
grub-install
Step 21 - Finally, run the following command to update the Grub configuration:
update-grub
Step 22 - Type "exit" to exit from the shell and then select Reboot the system.
At this point, you should disconnect the Debian ISO from the vSphere UI or ESXi Embedded Host Client. You probably will see the following warning stating the GuestOS has locked the CD-ROM drive, go ahead and click on Yes to disconnect and that should allow the VM to continue booting from updated VMDK now.
If all changes were applied successfully, Kali Linux should boot up and you now see the login screen as shown in the screenshot below. The default username and password is kali/kali
Congratulations, you now have Kali Linux running on ESXi-Arm!
VMware Tools can also be installed on Kali Linux, for detailed instructions, please see this blog post.
Dennis Faucher says
Thanks for doing this. I ran into this space constraint in a few other distros and this might solve the issue for those distros as well.
Johnny says
While it's great to keep on record.. The proper usability is quite.. low, as the pi is not a pc and just swaping the sd card can be faster than doing a 'virtual' switch..
Dennis Faucher says
@Johnny, are you inferring that hypervisors have no value?
Mark Emery says
Did you forget to write the new partition table to disk? resize2fs should have reported on-line resizing required, not the nothing to do. Without the resize, the apt install -y linux-image-arm64 grub-efi-arm64 will run out of space.
John Loy says
If you are using Ubuntu Server, then use unxz to decompress the image from Kali.
Make sure you do a capital "W" when writing the table. Otherwise you think it looks good but when you quit, the partition is not actually expanded. Also make sure you increase the disk size before doing the rescue disk.
Maroon Maroon says
Hello
I have followed your tutorial from A to Z, but I cannot start KALI.
the linux-image-arm64 and grub-efi-arm64 packages are not available for Kali, I modified the /etc/apt/source.list file and I added some debian repositories but without seccess.
I have tried the linux-image-arm and grub-efi-arm packages but they are not compatible with the ARMEL system.
Anyone with an idea please.
good day and thank you in advance.
Redling Gábor says
I have the same problem linux-image-arm64 grub-efi-arm64 are not available...
Any idea?
Tweety Sat says
Also same problem.
Raspberry pi 4 8gb.
ESXi-7.0.0-17230755-standard (VMware, Inc.)
debian-10.8.0-arm64-netinst.iso
kali-2020.4.vmdk
Unable to locate package linux-image-arm64
and
Package grub-efi-arm64 is not available, but is reffered to by another package.
...
Gabor Redling says
Cannot get access to /etc/fstab ...
VMphibian says
Is anyone else running into segmentation fault message when trying to execute cfdisk (or anything in /sbin)? I can execute all the binaries in /bin just fine (stuck on step 15). TIA!
ding lui says
Great article that turns useless when grub cannot be installed and the author refuses to answer the question from various readers all having the same issue. One doubts wether the author actually implemented this or just took screenshots from kali linux running on another system
Dennis Faucher says
That comment is neither helpful nor kind and should be deleted. William posts multiple helpful posts weekly and should be thanked not disrespected.
William Lam says
Folks - I receive quite few comments on a regular basis (some commentary, some issues, typos, etc.) and I do try my best to address, but due to time (as this is a personal blog), I don't always have the cycles to respond to every comment. I get there's been a few comments about instructions not working and I've just not had the spare time to investigate. The blog is also not the only place I get questions/comments, so please try to understand and be respectful.
It certainly doesn't help or give motivation when someone attempts to "trash talk" on not being responsive ... I know this is usually rare.
When I had first blogged about this solution, which is based off of a real setup, so for anyone "doubting" this was random screenshots that I magically found online that had my domain. Looking at the current download and the commands I showed, you can see the version that was available at the time of this blog post was "2020.4" but looks the latest is now "2021.1" and I'm guessing something has changed causing the issue.
I tried plugging in a previous version but don't see those downloads available but guessing if you can get your hands on that (several customers have even shared their success after posting the initial blog), so it definitely worked at that time. I've got the bits downloaded but not sure when I'll get time to investigate further ...
Cyprien says
For those looking at Kali 2021, you can just download the Kali Linux ARM64 ISOs, tagged "For Apple M1". The live ISO just works, and the NetInstaller is in progress as I am writing this.