openSUSE Leap 15.0 - EFI boot on MacBook Pro 9.2
- Introduction
- Partition scheme
- Installation
- Make openSUSE bootable from MacBook's boot manager
- 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:
- macOS is installed and booted by default;
- neither rEFIt nor rEFInd is used, and
- openSUSE can be booted by pressing and holding alt after turning on the computer.
It will be assumed that
- macOS is already installed;
- the EFI partition used to install openSUSE is not the same EFI partition used by macOS, and
- a bootable USB installer with the "Network Image" is used for the installation.
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
- there is a partition formatted as HFS+;
- the partition contains the partition id
af00
; - in the root of that partition, there is a file called
mach_kernel
, and - inside that partition, there is a
boot.efi
file inside/System/Library/CoreServices
.
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 point | Type | Comments |
---|---|---|
/boot/EFI | EFI partition | |
/ | ext4 | root partition |
/home | ext4 | home partition |
swap | swap | in 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>
- Type
p
and look for the numbere
of the EFI partition number. - Type
d
and specify the partition numbere
. - Type
n
and specify the partition numbere
. For first and last sectors set the same values that the partition currently has. Finally, setAF00
as the filesystem code. - Type
w
.
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.