Quick and easy Linux USB Live drive for Mac OSX

In my last post I went through the details of partitioning and setting up your Linux USB live drive with persistence, specifically for Kali Linux.

If you’re already familiar with partitioning the drive then you can continue, if not I advise you to check my previous posting and come back here later.

So I am assuming you already have a FAT partition on your USB thumb drive that is around 4GB in size. All you need to do now is download the file at this link. These files are what is created by the free tool “Mac Linux USB Loader

After you extract thee files, copy the whole root folder (titled efi) to your USB drive partition. Inside the efi folder, is another folder called boot. Inside this you you will find several files. All you now need to do is download the Kali Linux .iso image file. Rename the downloaded file to be “boot.iso” and then copy this inside the boot folder on the USB thumb drive. That’s pretty much all there is to it, go ahead and reboot your mac holding down the option key and you should have the efi boot menu as an option from where you can boot into your Linux distribution.

In theory this will work with any Debian based Linux (such as Ubuntu for example). You just follow the same procedure. There will be some manual editing required to the enterprise.cfg file so that the correct Linux distribution name is displayed but this is easily done within text edit on OSX.

In the files that I have provided the enterprise.cfg file has been edited already to allow for persistence booting of Kali Linux, so that the changes you make and files you create are saved for the next session. However, in order to make this function work there are a few procedures you need to follow in addition to the above. This involves creating a new partition for storing the persistence data on, and creating a mount point for this. All of this procedure can be found here.

The video below also gives a comprehensive overview of setting up the Kali Linux USB Live Drive as well as partitioning the disk correctly and configuring the persistence partitions.

REFERENCES :-

http://docs.kali.org/downloading/kali-linux-live-usb-persistence

https://sevenbits.github.io/Mac-Linux-USB-Loader/

Kali Linux USB With Persistence On Mac

Getting Kali Linux, or any other Linux distribution, up and running on your Mac can sometimes be problematic. Although things have gotten easier with some new tools. As a Macbook Pro user (mid 2014 model) I wanted to be able to use Kali Linux on my Macbook in a USB liveboot mode, with persistence. One primary reason for wanting to maintain persistence is that there is quite a bit of setup involved to get all the drivers working, and I didn’t want to have to go through all of that each time I booted into Linux.

I tried many methods of getting things working, even following the instructions on the Kali Linux website didn’t work exactly. I ended up with a strange occurrence when rebooting that I had to select the windows partition for boot rather than the mac EFI. Below are my instructions on how I set up this live USB with persistence, it’s produced reliable results and hopefully it will do for you to. The process was done using my Macbook Pro mid 2014 model, running OSX El Capitan.

There’s a few things you will need in order to get started.

  1. A USB stick with minimum of 8GB storage (I’m using a 16GB scan disk USB3.0 thumb drive)
  2. Download the free software “Mac Linux USB Loader” from here https://sevenbits.github.io/Mac-Linux-USB-Loader/
  3. Download the latest build of Kali Linux (I use the amd64 version) and keep the .iso file in your downloads folder

STEP 1

  • First we need to prepare the USB stick. We will use the MAC OSX native disk utility tool for this. Open the Disk utility tool, and select the correct USB device (in my case SanDisk Cruzer…..)
    step1
  • Click on “Erase” and choose the following options
    • Name – Kali Linux
    • Format – MS-DOS (FAT)
    • Scheme – Master Boot Record
      step1_2
  • Press the “Erase” button. The Disk Utility will then run through it’s formatting process. When finished click on “Done“. You should now have a single clean partition on your USB drive as shown below.
    step1_3

Now the USB disk has been prepared we can move onto the next step, which will be to setup the drive using the “Mac Linux USB Loader“.

STEP 2

  • Open up the Mac Linux USB Loader software and select “Create Live USB“. This will bring up a finder window, where you can navigate to your downloaded Kali Linux.iso disk image. Select the Kali Linux disk image that you downloaded earlier.
    step2
  • On the next screen you will see your USB thumb drive listed with he name “kali Linux” (if you named it that when formatting). Select this USB drive and click “Next
    step2_2
  • On this screen click on “Begin Installation“.
  • Once this has completed, you should now find a directory structure on the USB disk like this :-/efi/boot inside the boot folder there will be a couple of .efi files and a “boot.iso” disk image.
    step2_3

STEP 3

  • There’s one final step we need to take in order to ensure that Kali Linux boots in persistence mode every time. We need to edit the enterprise configuration file. Open up the Mac Linux USB Loader again, and select the option “Setup USB Device“.
    step3
  • In the new window, select the Kali Linux USB drive from the left side. This is a list of the various available bootable USB drives. Once the correct drive is selected click on “Edit Enterprise Configuration File“. This will open a text edit window with the configuration file. You need to change the “hostname” from “kali” to “kali persistence“. Save this file, and close.
    step3_2
    step3_3
  • Your USB bootable disk is now ready. Reboot your Macbook Pro while holding down the “alt / option” key. You will be presented with a boot option list, select the “EFID” boot option. This will present another menu where you can select the boot mode, and the available Linux Distributions. Kali Linux should then boot up and now you have a Linux Live session running on your machine. There’s now just one more thing we need to do in order to setup persistence and make it work correctly.

STEP 4

  • We will use Linux tools to resize the partition. You can use the GUI tool “GParted” or it can be done through the terminal. Here’s the terminal commands :-
    • end=7gb
    • read start _ < <(du -bcm kali-linux-1.0.8.amd64.iso | tail -1); echo $start
    • parted /dev/sdb mkpart primary $start $end
  • after the parted process has finished there will be a new partition created at /dev/sdb3. You can verify this with the “disk -l” command to list all available drives.
  • Next we wil create a ext3 filesystem in the new partition. the filesystem will be labeled “persistence”. The terminal commands are as follows :-
    • mkfs.ext3 -L persistence /dev/sdb3
    • e2label /dev/sdb3 persistence
  • Next we will create a mount point for the new partition and then create the persistence configuration file, finally we will then unmount the partition. Here’s the terminal commands :-
    • mkdir -p /mnt/my_usb
    • mount /dev/sdb3 /mnt/my_usb
    • echo “/ union” > /mnt/my_usb/persistence.conf
    • umount /dev/sdb3
  • We are pretty much done! All that remains now is to reboot (using the option key again to boot into Linux). Once into Kali Linux create a new folder on the desktop, or a file in the documents folder. Reboot again, and check that it’s still there. If so then congratulations you’ve done everything right and you now have a live bootable USB drive running Kali Linux in persistence mode on your Macbook Pro.

Now all that remains is to get the Wireless adapter working. This is by far the most difficult part of the whole process, the broadcom drivers for Linux aren’t well supported, and depending on the model year of your Macbook Pro will depend on what chipset version and driver you need.

References :-

https://studyblast.wordpress.com/2011/08/14/guide-mac-os-x-lion-how-to-boot-a-linux-live-system-from-a-usb-drive-how-to-update-any-ocz-ssds-firmware/

http://www.makeuseof.com/tag/how-to-boot-a-linux-live-usb-stick-on-your-mac/

http://docs.kali.org/downloading/kali-linux-live-usb-install

http://docs.kali.org/downloading/kali-linux-live-usb-persistence