This howto will show you how to create a bootable Linux USB on and for the Macbook. Specifics used in this example include:
- Macbook Pro 2012 running Mountain Lion
- USB Thumb Drive
- Puppy Linux iso
Challenges and Explanations
In order to get this to work properly, you’ll need at least one ext2, ext3, or ext4 partition with a GUID partition table. Unlike their PC counterparts, Macs use the Extensible Firmware Interface (EFI) for bootstrapping, not the Basic Input/Output System (BIOS). Thus, the GUID partition table is needed for Mac booting (as opposed to the standard MBR partition table used by PC BIOS).
The bootable partition containing our Puppy Linux image will need to be located on an ext2, ext3, or ext4 partition. Unfortunately, OSX Disk Utility does not provide those formatting options. Similarly, Linux’s gparted offers only limited GUID/EFI support. So we will need to do the initial USB thumb drive preparation with Disk Utility, and the remaining prep inside our Live CD Linux environment.
USB Drive Preparation – Part I
First, insert your thumb drive into your Mac, and start Disk Utility. You should see something like this:
Select one partition, and MS-DOS FAT32 or Free Space.
Next, click the options button below the partition window:
And select “GUID Partition Table”. Click “OK” and then in the main dialog window, click “Apply”.
This completes the initial USB prep.
USB Drive Preparation – Part II
It is assumed that you have already burned a Puppy Linux Live CD. Insert that into your Mac, and reboot your laptop. As the machine begins its reboot, hold down the “c” key until the Puppy dialog is displayed.
Now, hit the F2 button and enter the following at the command prompt:
The purpose of this command is that I found really long delays waiting for Puppy to try and find a session file that doesn’t even exist. By specifying the “pfix=ram” option, you force Puppy to ignore any session files, and just load the default configuration into RAM.
Once Puppy is fully booted, open the Console and enter the command for gparted:
Under the “Gparted” menu option, select “devices” and find your USB drive which should still be plugged-in. You should now see the partition layout, which should consist of a small “EFI” partition, and a much larger FAT32 partition.
Assuming that the EFI partition is /dev/sdb1, your FAT32 partition should be /dev/sdb2. Select the /dev/sdb2 partition, and under “Partition->Format To” select ext2, ext3, or ext4. Hit “Apply”.
Once that reformatting is complete, highlight the partition again, and select “Partition->Manage Flags”. Select the “boot” box in the pop-up dialog and click “OK”.
Now select the EFI partition, select “Partition->Manage Flags” and click OFF the boot option.
You should now be ready to install Puppy to the USB thumb drive.
Since puppy is loaded in memory, the Live CD has effectively been unmounted. Go to “Mount” and select “Optical” in the tabs of the pop-up, and mount the Live CD. You will need the files there. Now, select “Install”, and click on the “Universal Installer” button. Select “USB Flash”, and then when prompted, choose to install Puppy to the “/dev/sdb2″ partition. You should be able to select the defaults from here on out. A yellow colored console will pop up and ask you some questions about nuking files on the partition and memory space. Answer “yes” to these questions and wait. Once the install finishes, unmount and eject the CD, and shutdown the machine.
Before restarting, go ahead and remove the USB drive. Reboot into OSX.
In order to selectively boot using the USB thumb drive, you’ll need to install a boot management tool like rEFInd. rEFInd is a nice branch off the rEFit boot manager, which no longer appears to be maintained, and did not work for me on Mountain Lion. Download the binaries and follow the installation instructions.
Now shutdown your Mac, insert the USB thumb drive, and restart. On boot you’ll see a couple of boot choices. The one on the far right should probably be something labeled as “Boot Legacy OS”. This should be your bootable thumb drive. Select it, and if all went well you should boot into Puppy.
A Note About Persistence
Puppy Linux is a nice distro to add to a USB stick since it is comparatively lightweight, has a small footprint, and saves session data and additional packages in an “ssf” file across sessions. This persistence file can be saved to the primary Puppy partition, or an alternate location. Specified sizes for the persistence file can be varied, but Puppy recommends 512MB as a fairly good size. If you save your persistence file to a location other than the main Puppy partition, you can load it automatically on startup by changing the boot settings in the Puppy “setup” menu.
You will be prompted to create the “ssf” persistence file by Puppy the first time you shut it down.