0

I'm essentially trying to instal Kali to a USB drive. I'm not making a live kali with/without persistence but an actual full install of kali onto a usb drive.

Live usb with persistence is a little too limiting in my case, I usually work on ubuntu and figured I could just switch to Kali and call it a day.

Description of the current situation

My macbook pro already has a dual boot with windows 10 and mac os X. I'm trying to create a usb kali install that will be recognized by the mac bootloader.

The way I'm going about installing Kali is setting up a Vbox to use a physical hard drive (usb) as a main disk and then mounting kali live to the virtual cd and installing it directly to the stick.

Works great kinda.

Problem

The problem is that by default grub will install to the MBR and recent versions of macbook seem to hate this (I never see the usb along side my other partitions when I boot with option). I imagine I need some sort of EFI compatibility/configuration but am not too sure how to proceed from here.

Most of the information I find online are all about making live usbs and not actual installations. There seems to be a way using rEFInd on the host but I'm looking for an option that would make my usb bootable on any device.

Any help would be appreciated.

1 Answer 1

0

Answering my own question.

The short answer is that recent macbook pros (at least 2017 and up) expect an ESP (FAT32) partition at the begining of your USB with a file located at /EFI/boot/bootx64.efi (replace x64 with your architecture if you are here for a similar issue but not on mac. The rest of this answer will assume x64). Oddly enough Kali installation does NOT include the file on this path and instead places it at /EFI/kali/kalix64.efi. Which is weird since the installed Kali includes /boot/efi/EFI/boot/bootx64.efi along side /boot/efi/EFI/kali/kalix64.efi.. Wonder why it doesn't directly include it into the proper partition from the get go.

There are a few other caveats so bellow is the basic walkthrough. I use VirtualBox because the internal keyboard, touchpad and wifi aren't supported by default so direct installation would require 2 USB drives, and at least an external keyboard or a custom build of kali installer, both of which were too much work compared to VirtualBox for me:

  • On Mac OS X open VirtualBox as root to avoid weird partitioning errors with sudo VirtualBox
  • Create a new VM, any hard drive option works. Make sure you have Settings > System > Enable EFI checked, this is mandatory. Set your USB up in Ports, and your kali installation ISO in Storage on the virtual CD
  • Boot into your VM and proceed to installation
  • Agree to anything UEFI related
  • When it comes to partitioning, select entire device and your USB. It will ask you if you want to reformat the partitioning table (or something along those lines) say yes. After that select the free space and do the recommended install. You should now have 3 partitions (ESP,ext4,swap). If you double check the ESP partition it should be an EFI bootable one (default settings from what I saw but worth double checking)
  • proceed with installation
  • agree to installing grub, if you get prompted about which device to install to, select your USB
  • finish installing and you should automatically reboot into your kali installation

Now, within kali we will fix the boot and install the missing drivers for your macbook:

  • Install keyboard and touchpad drivers check the full install doc for your specific macbook version. Bellow is what worked for me (14,3):
echo -e "\n# applespi\napplespi\nspi_pxa2xx_platform\nintel_lpss_pci" >> 
/etc/initramfs-tools/modules

apt install dkms
git clone https://github.com/roadrunner2/macbook12-spi-driver.git /usr/src/applespi-0.1
dkms install -m applespi -v 0.1
  • Fix the grub options by running sudo update-grub. For some reason the installation grub.cfg file includes device paths rather than UUIDs. Probably because of the live grub configuration. This will fix it and prevent the annoying issue where you see grub but then it fails to find the correct partition and file path
  • Find your ESP partition with fdisk -l. You're looking for a 200-250MB fat32 partition, should be the first partition on your USB. Once you have the /dev/sd{x}{#} proceed to the next point. (will likely be /dev/sdb1 if you followed the above VM configuration)
  • Mount the partition with mount /dev/sd{x}{#} /mnt (replace {x},{#} as appropriate)
  • ls /mnt/EFI/kali/ should show you a kalix64.efi file. Just create a new boot folder and copy this file while renaming it:
mkdir /mnt/EFI/boot
cp /mnt/EFI/kali/kalix64.efi /mnt/EFI/boot/bootx64.efi
  • shutdown your VM, restart your mac with the USB in and the option button pressed
  • enjoy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .