In order to install Linux on the replacement of a crashed hard-disc drive in a 2006 Macbook Core duo, I wanted to boot Linux from a USB flash drive in order to then install it. While this is trivial on most PCs, it turned out not to be on an old Macbook.
The white Core duo (without the 2) 32-bit Macbook was purchased in September 2006 and used to dual boot Gentoo Linux and Mac OSX using rEFIt. The original 100Mb hard disc was failing and I bought a 500Mb drive to replace it. Since OSX hadn’t been booted for some years, I decided to install Linux only. It turned out that booting Linux from a USB flash drive / USB pen drive / USB stick (or CD for that matter) is nearly impossible without rEFIt or its modern clone, rEFInd. Google found solutions that may work for more modern Macbooks (pro), but not for this machine. In addition, the original installation CD did not recognise the 500Mb disc (but reported it was 3.0Tb) and Disk Utility (luckily) refused to do anything. Hence, I needed a USB flash drive that booted on my Macbook without rEFIt/rEFInd, and I needed to prepare it on another Linux machine.
The main reason for the problem is that while booting on UEFI (as opposed to BIOS) systems is well supported by Linux, Apple seems to be using their own, unique mix of features from different versions. As an aside, it is interesting to wonder why Apple would make it hard for their customers to install whatever operating system they wish on the hardware they purchased and hence own. The first reason that springs to my biased mind is that Apple stuff is shit and forbidding people to compare it with superior alternatives is a good way of keeping your iSheep uninformed, meek and obediently buying. Why did I get a Macbook in the first place? Because for my new job (back then), I could choose between a Mac and a Mac. Since I needed to work on it efficiently, and not stare at its shineniness, I gave up on the OS after a few months (it was harder to do that with the hardware) and installed Linux as a dual boot. Since I never want to boot MacOS again, I want to use this opportunity to turn the Macbook into a Linux-only machine (and change Linux flavours).
The solution I found uses the ISO 2 USB EFI Booter for Mac (with unclear origin) to boot from the ISO image of a LiveCD, but with some small but important changes: use a FAT32 file system, place the EFI file in /efi/boot/ and rename it to boot.efi. The minimal working solution for me was:
- Download ISO 2 USB EFI Booter for Mac, and unzip the archive. You’ll find two (useful) files: bootIA32.efi and bootX64.efi. You’ll need only one of these, since your system is either 32 or 64 bit.
- Download the ISO image of a Linux LiveCD or LiveDVD. The ISO image must have “support for loopback” in order to work. I succesfully booted from the Kubuntu 13.10 desktop ISO and Ubuntu 12.04 LTS desktop ISO. The latter is a 30% smaller download; later versions of Ubuntu allegedly don’t have loopback support. Linux Mint is said to work as well, but I didn’t try this. None of the Gentoo or Arch Linux ISOs I tried worked.
- Ensure the ISO file will fit on your USB flash drive. Backup important content from your drive — it will be erased.
- Make one large partition on your USB flash drive, using e.g. (g)parted, (c)gdisk, or (c)fdisk. You can use either a GUID partition table (GPT — unless you’re using (c)fdisk) or an MSDOS/MBR partition table, both will work. Use “Microsoft basic data” (code 0700) as the partition type.
- Format the partition with FAT32. (g)parted can do this. Alternatively, you can type
mkfs.vfat -F 32 /dev/sdX1from the command line (after replacing the “X” with the correct letter for your USB drive). Formatting with HFS+, as some sources indicate, didn’t work for me.
- Mount your drive and cd into it (as root:
# mkdir /mnt/usb && mount /dev/sdX1 /mnt/usb && cd /mnt/usb).
- Create the directory efi/boot/ in the current directory (
# mkdir -p efi/boot/) — (i.e., the full path of this directory is /mnt/usb/efi/boot/ if your USB drive is mounted in /mnt/usb/).
- Copy either
bootX64.efito the new directory (depending on whether you have a 32 or 64-bit system), and rename the file to
- Copy the downloaded LiveCD image to the new directory, and rename it to
- That’s all. The USB drive now contains two directories and two files, and should boot. Make sure you used the file and directory names as provided here. For clarity, all that is now on your USB drive is (relative to the root directory of that drive):
In order to install Linux, I booted Kubuntu using the method described above, installed rEFInd from there, which then allowed me to boot from a normal Live USB flash drive. I ended up installing Arch Linux. The details and non-trivialities of the Linux installation will be described in a future post. I didn’t manage to install Linux without installing rEFInd though, so in retrospect I might as well have installed rEFInd on my new disc, mounted as an external disc to my other Linux computer.