Category Archives: Linux

Dual-booting Arch Linux on a Macbook with encryption

This was a tricky one to work out, but here’s how I got there with my MacbookPro 11,1. This may not be the best way, but it’s the only one I could get working.

Firstly, use Disk Utility on OS/X to reduce it’s partition size, allowing enough free space to install Arch. Download the Archboot ISO, put it on a USB key and turn the Macbook on while holding down Alt to boot from it.

Use the Archboot GUI to prepare the storage disk. Don’t let the script do it automatically; use the partitioning program to add the following:

  • EFI partition (128M, type af00)
  • Boot partition (128M, type 8300)
  • System partition (rest of space, type 8e00)

Exit the Archboot GUI, then follow these instructions up to the mkinitcpio part. This will create a LUKS container in the system partition and install LVM partitions. Once that’s done, reboot back into the Archboot GUI.

Set up your key mapping, date/time and network. In the storage disk preparation menu, mount the boot and encrypted system partitions. Use Archboot to select and install all of the base, dev and support packages and configure the system. Exit the GUI before you install the bootloader.

Use this command to log into your new system:

arch-chroot /install /bin/bash

Configure mkinitcpio by adding ‘encrypt’ and ‘lvm2’ to the HOOKS property in /etc/mkinitcpio.conf, and run the following commands:

mkinitcpio -p linux-lts
mkinitcpio -p linux

Edit /etc/default/grub and update the following lines:

GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libata.force=noncq"
GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdaX:MyStorage root=/dev/mapper/MyStorage-rootvol"

To generate an EFI bootloader, use the following commands (taken from here)

grub-mkconfig -o /boot/grub/grub.cfg
grub-mkstandalone -o boot.efi -d /usr/lib/grub/x86_64-efi -O x86_64-efi /boot/grub/grub.cfg

Insert a USB key, mount it and copy the boot.efi file.

mount /dev/sdX1 /mnt
cp boot.efi /mnt

In OS/X use Disk Utility to format (‘erase’) the 128MB EFI partition, move the boot.efi file into System/Library/CoreServices/ and create a file in the same directory called SystemVersion.plist, with the following contents:

<?xml version="1.0" encoding="utf-8"?>
  <plist version="1.0">
  <dict>
    <key>ProductBuildVersion</key>
    <string></string>
    <key>ProductName</key>
    <string>Linux</string>
    <key>ProductVersion</key>
    <string>Arch Linux</string>
  </dict>
</plist>

If you’re lucky, you should now be able to boot into Arch by holding down the Alt key while booting. If not, here are some resource which should help you out. Good hunting!