In January 2007 I bought my first OS X device, a white 13.3-inch MacBook, running OS X 10.4 Tiger on a 2.0Ghz Intel Core 2 Duo processor, having 1GB of RAM. Along the way I upgraded it to 2GB RAM and gave it a fantastic boost by replacing the HDD by an Intel 320 Series SSD. I also upgraded OS X to 10.5 Leopard, 10.6 Snow Leopard and in the end to 10.7 Lion. At the same time YouTube started (2008) offering 720p HD videos. Now almost all videos are available in >720p format. What always frustrated me a bit is that this MacBook wasn’t 100% capable to show 720p YouTube videos. It was viewable, but with annoying frame-drop here and there.
Lately I stumbled upon this “Linux Sucks” YouTube video, which showed the enormous growth of elementary OS on distrowatch.com in the past years. I was interested. Normally I use Debian with i3 or sometimes Gnome3. But I was interested in this lightweight Ubuntu based OS to replace OS X on my MacBook.
I’d like to explain how I installed elementary OS on my MacBook including full disk encryption.
Creating a MacBook compatible bootable USB stick
First of all I downloaded the 32-bit ISO of the latest elementary OS release (Freya). To be able to boot this ISO from a USB stick on a MacBook, you have to create FAT32 formatted USB stick which contains an EFI/BOOT/ folder, with 2 files in there:
- EFI/BOOT/bootIA32.efi (ISO-2-USB EFI-Booter for Mac, used ev–ery–where)
- EFI/BOOT/boot.iso (renamed elementaryos-freya-i386.20150411.iso)
Installing elementary OS
Now you can boot from the USB stick. After a minute or 2 the live CD is started.
Start the installation by clicking the bottom-right CD icon and follow the wizard.
When you get a question about unmounting /dev/sdb, just say “No”. /dev/sdb is your USB device. At the “Installation type” screen choose “Something else”.
The interesting part starts now. This screen shows the partition layout of the recognized devices. /dev/sda here is the internal harddrive. In my case it also says INTEL SSD at the bottom. Again ignore /dev/sdb, this is your USB device.
When OS X is installed you have a couple of partitions on the internal harddrive:
- /dev/sda1: EFI partition, required for booting
- /dev/sda2: HFS+ partition containing Mac OS X
- /dev/sda3: An optional ~650MB recovery partition (since OS X 10.7 Lion)
Remove /dev/sda2 and /dev/sda3. Now create 2 new partitions on /dev/sda:
- a 256MB ext2 partition, this will be the /boot partition
- fill up the rest with a partition that will be used as “physical volume for encryption“
The installer tries to be smart now, by marking sda3_crypt to be formatted as ext4. Change this partition and configure it to not format it. After that “Quit” the installer.
We just quit the installer, because we want to create 3 partitions in the encrypted sda3_crypt for the root partition (/), swap partition and home partition (/home) using LVM2. This is not possible to configure this via the installer.
Open the terminal App. As you can see /dev/sda3 is encrypted and referred to as /dev/mapper/sda3_crypt. Now execute the pvcreate, vgcreate and lvcreate commands. We’ll create a 10GB root partition, 4GB swap partition and the rest is for the home partition. You’ll see it also created some device symlinks in /dev/mapper.
Now run through the installer once again. At the “Installation type” screen choose “Something else” once again.
Now you see that the installer sees the partitions we just created. Configure the partitions:
- /dev/mapper/apple-home: btrfs partition mounted at /home
- /dev/mapper/apple-root: ext4 partition mounted at /
- /dev/mapper/apple-swap: swap partition
- /dev/sda2: ext2 partition mounted at /boot
Continue clicking “Install Now” and click “Continue” to confirm to write the changes to disk.
Follow the wizard until it starts installing elementary OS and wait for a while.
It will fail to install the bootloader. Continue without a bootloader. After that the installation from the wizard is complete. Choose “Continue Testing” here.
Now we have to fix the bootloader manually. Open the Terminal App. Mount the required partitions and chroot into the new elementary OS installation. Install grub-efi-ia32 and run grub-install. Copy a grub.mo file to /boot/grub/locale/en.mo and run grub-mkconfig to generate the grub configuration.
To make the initial RAMdisk (/boot/initrd.img) aware that /dev/sda3 is an encrypted partition. Put the desired configuration in /etc/crypttab and update the initial RAMdisk.
You can now reboot the MacBook. The funny thing is that elementary OS is snappier then OS X on this MacBook. And it now plays 720p videos flawlessly. 😀