openSUSE Leap 15.0 - EFI boot on MacBook Pro 9.2

  1. Introduction
  2. Partition scheme
  3. Installation
  4. Make openSUSE bootable from MacBook's boot manager
  5. References

Introduction

This guide shows how to install openSUSE Leap 15.0 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 bootloader 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 official installation steps, or my installation guide. Then continue with this guide.

Make openSUSE bootable from MacBook's boot manager

Install utilities for HFS+ filesystem

$ zypper ar -f http://download.opensuse.org/repositories/home:/malcolmlewis:/openSUSE_General/openSUSE_Leap_15.0/ MalcolmLewis
$ zypper refresh
$ zypper install diskdev_cmds

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 openSUSE

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

Reinstall GRUB

$ mkdir -p /boot/efi/EFI/openSUSE
$ touch /boot/efi/EFI/openSUSE/mach_kernel
$ grub2-install --target x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi --bootloader-id="openSUSE"
$ sed -i 's/GRUB_HIDDEN/#GRUB_HIDDEN/g' /etc/default/grub
$ grub2-mkconfig -o /boot/grub/grub.cfg

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

Make MacBook's boot manager recognize the openSUSE installation

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

The system should now be bootable.

Customise bootloader 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 openSUSE EFI partition, boot into macOS and execute

$ diskutil info /Volumes/openSUSE | 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