Arch Linux - MacBook Pro 9.2
EFI boot using native Apple boot loader with GRUB

  1. Introduction
  2. Make Arch Linux bootable from MacBook's boot manager
  3. Customise boot loader icon
  4. Prevent macOS from mounting the EFI partition
  5. References

Introduction

This guide shows how to install Arch Linux in UEFI mode on a MacBook Pro 9.2. The installation will have the following characteristics:

It will be assumed that

Partition scheme

According to [1], the MacBook's native EFI boot loader looks for .efi files inside all partitions in internal and external drives and shows them as possible boot options if certain conditions are satisfied. Particularly, MacBooks can detect an existing macOS installation after checking that

Also, according to [1], it is possible to perform the installation with the already existing EFI partition used by macOS, but that is out of the scope of this guide.

The following partition scheme will be used:

Mount pointTypeComments
/boot/EFIEFI partition
/ext4root partition
/homeext4home partition
swapswapin a non solid-state drive

Installation

Follow either the ArchWiki's installation guide, up to and including the step before Boot loader, or my installation guide up to and including the step before Boot loader. Then continue with this guide.

Make Arch Linux bootable from MacBook's boot manager

Install utilities for HFS+ filesystem

Switch to an unprivileged user <user> for building and installing the hfsprogs package from AUR

$ su <user>
$ cd ~

Install the hfsprogs package

WARNING: Carefully check the PKGBUILD, any .install files, and any other files in the package for malicious or dangerous commands.

$ git clone https://aur.archlinux.org/hfsprogs.git
$ cd hfsprogs
$ makepg -si

Switch back to root user by executing exit or pressing Ctrl+D.

Fix EFI partition

Find out the partition mounted on /boot/efi

$ mount | grep /boot/efi

and unmount it

$ umount /dev/sd<De>

where <De> refers to the device identifier and partition number of the EFI partition.

Update the EFI partition

$ fdisk /dev/sd<D>

Format the EFI partition

$ mkfs.hfsplus /dev/sd<De> -v archlinux

where <De> are the same values as above.

Update /etc/fstab file

Open /etc/fstab and delete the line that refers to /boot/efi, save and close the file.

Execute

$ bash -c 'echo UUID=$(blkid -o value -s UUID /dev/sd<De>) /boot/efi auto defaults 0 0 >> /etc/fstab'

where <De> are the same values as above.

Mount the EFI partition

$ mount /boot/efi

Install GRUB

$ pacman -Syu grub efibootmgr
$ mkdir -p /boot/efi/EFI/archlinux
$ touch /boot/efi/EFI/archlinux/mach_kernel
$ grub-install --target x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi --bootloader-id="archlinux"
$ grub-mkconfig -o /boot/grub/grub.cfg

Open /boot/efi/EFI/archlinux/System/Library/CoreServices/SystemVersion.plist and modify the ProductName string value to Linux and the ProductVersion string value to ArchLinux.

Make MacBook's boot manager recognize the ArchLinux installation

$ mkdir -p /boot/efi/System/Library/CoreServices
$ touch /boot/efi/mach_kernel
$ ln /boot/efi/EFI/archlinux/System/Library/CoreServices/boot.efi /boot/efi/System/Library/CoreServices/boot.efi
$ cp /boot/efi/EFI/archlinux/System/Library/CoreServices/SystemVersion.plist /boot/efi/System/Library/CoreServices/

Create a new initramfs

$ mkinitcpio -p linux

The system should now be bootable.

Customise boot loader icon

In order for a custom icon to appear on the MacBook Pro boot manager, copy a .icns file to /boot/efi/

$ cp <file.icns> /boot/efi/.VolumeIcon.icns

Prevent macOS from mounting the EFI partition

To prevent macOS from automatically mounting the Arch Linux EFI partition, boot into macOS and execute

$ diskutil info /Volumes/archlinux | grep "Volume UUID" | awk 'NF>1{print $NF}'

copy the UUID value, then execute

$ sudo vifs

add

UUID=<copied UUID value> none hfs rw,noauto

in a new line, save and close the file.

References

  1. Mac - ArchWiki
  2. Ubuntu installation on USB stick with pure EFI boot (Mac compatible)
  3. Ubuntu + Mac: Pure EFI Boot
  4. Debian EFI mode boot on a Macbook Pro, without rEFIt
  5. Managing EFI Boot Loaders for Linux
  6. Unified Extensible Firmware Interface - ArchWiki