Triple boot macOS High Sierra, Ubuntu, and Windows without rEFInd
I currently have three OSes installed on my 2017 MacBook Air: macOS, Ubuntu, and Windows 10. I couldn't boot into Ubuntu without rEFInd, but I strongly prefer the default boot manager, because I want to use the firmware password (which rEFInd doesn't have).
Is there any way for the macOS boot manager to recognize Ubuntu without using a third-party boot manager?
NOTES:
- I don't want Ubuntu set as my default OS as an alternative. I just want it to appear in the boot menu.
- I don't mind if it just goes into GRUB. As long as it somehow can load the kernel, it's fine.
The output from the command diskutil list
.
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk1 242.6 GB disk0s2
3: Linux Filesystem 49.9 GB disk0s4
4: Microsoft Basic Data WinData 75.1 GB disk0s5
5: Microsoft Basic Data Windows 125.1 GB disk0s6
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +242.6 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD 74.0 GB disk1s1
2: APFS Volume Preboot 25.1 MB disk1s2
3: APFS Volume Recovery 506.6 MB disk1s3
4: APFS Volume VM 2.1 GB disk1s4
Solution 1:
Alternative Second Answer
This second answer differs from my first answer in the following ways.
The second EFI partition is replaced by a HFS+ partition.
The label displayed in the Startup Manager will be "Ubuntu" instead of the generic "EFI Boot".
I will assume the following:
- You have install Ubuntu to use the EFI boot method.
- You are using grub to boot Ubuntu
- Grub boots from the EFI partition.
- There is only one EFI partition.
- The EFI partition is the first partition on the Disk.
- There is only one disk involved and the disk is internal.
- rEFInd is installed in the EFI partition.
I will offer two ways to solve your problem. Each has it pros and cons.
The Mac Startup Manager will display an operating system if you place the .efi file in the right location. This location is the System/Library/CoreServices
folder of the volume in a HFS+ partition. The file name must be boot.efi
. Furthermore, you can customize the icon displayed for the operating system by placing a .VolumeIcon.icns
file in the root folder of the volume in the HFS+ partition.
The First Way.
Note: Here, rEFInd is still being used, but not as a replacement for the Startup Manager. You will be able to use a firmware password. In fact, no rEFInd menus are displayed. The rEFInd boot manager just silently boots grub (which boots Ubuntu).
- Download rEFInd from this SourceForge website. I assume the downloaded file is named
refind-bin-0.11.2.zip
and this file was downloaded to your~/Downloads
folder. - Create a new HFS+ partition. Instructions are given in the section "Adding a HFS+ Partition".
-
Mount the new HFS+ partition, by entering the following command.
sudo diskutil mount disk0s3
The new HFS+ partition will have the volume name
Ubuntu
. -
Install rEFInd into the volume on the new HFS+ partition.
cd ~/Downloads/refind-bin-0.11.2 ./refind-install --ownhfs /dev/disk0s3
Note: The error message
Could not set boot device property: 0xe00002bc
was expected and can be ignored. -
Configure the TextEdit application. Open TextEdit, then navigate to the "Preferences..." window. Uncheck all the "Options", as shown below. When finished, quit TextEdit.
-
Use the command below to navigate to the folder containing the
refind.conf
file.cd /Volumes/Ubuntu/System/Library/CoreServices
Make a backup copy of this file.
sudo cp refind.conf refind.conf.orignal
Add write permissions to the
CoreServices
folder and therefind.conf
file.sudo chmod a+w . refind.conf
Open the file in the TextEdit application.
open -e refind.conf
-
In this volume, edit the
System/Library/CoreServices/refind.conf
file to silently boot grub (which will intern boot Ubuntu). This can be accomplished by adding the following lines to the end of therefind.conf
file. You should be able to just cut and paste these lines. When finished, save the changes, then quit TextEdit.# # Added to make rEFInd silent. # menuentry "Ubuntu" { icon \System\Library\CoreServices\icons\os_ubuntu.png volume "EFI" loader \EFI\ubuntu\grubx64.efi ostype Linux graphics on } timeout -1 hideui all scanfor manual
-
Unmount the new volume named
Ubuntu
, by entering the following commands.cd ~ diskutil unmount disk0s3
Pros: Ubuntu is unaffected, so any Ubuntu updates will not require attention.
Cons: You need to use the third party boot manager rEFInd.
The Second Way.
- Create a new HFS+ partition. Instructions are given in the section "Adding a HFS+ Partition".
-
Mount the original EFI partition and the new HFS+ partition, by entering the following commands.
sudo diskutil mount disk0s1 sudo diskutil mount disk0s3
The original EFI partition will have the name
EFI
and the new HFS+ partition will have the nameUbuntu
. -
In the new volume named
Ubuntu
, create the foldersEFI/ubuntu
andSystem/Library/CoreServices
, by entering the following commands.mkdir -p /Volumes/Ubuntu/EFI/ubuntu mkdir -p /Volumes/Ubuntu/System/Library/CoreServices
-
Copy the files
grub.cfg
andgrubx64.efi
to the new volume namedUbuntu
. The commands needed are given below.cp /Volumes/EFI/EFI/ubuntu/grub.cfg /Volumes/Ubuntu/EFI/ubuntu/grub.cfg cp /Volumes/EFI/EFI/ubuntu/grubx64.efi /Volumes/Ubuntu/System/Library/CoreServices/boot.efi
-
Unmount the original EFI partition and the new HFS+ partition, by entering the following commands.
diskutil unmount disk0s1 diskutil unmount disk0s3
Pros: You do not need to use the third party boot manager rEFInd.
Cons: If the grubx64.efi
or grub.cfg
is updated, you have to manually copy these files to new volume named Ubuntu
.
Adding a Custom Icon
The steps below will add the following Ubuntu icon to the Startup Menu.
- Download a collection of icons from the sourceforge web site Mac icns.
- Use the Finder application to open the downloaded file
mac-icns.dmg
. I assume this file downloaded to your~/Downloads
folder. -
Mount the volume named
Ubuntu
by entering the following command.sudo diskutil mount disk0s3
-
Use the Finder application to copy the
os_ubuntu.icns
icon file to the root folder of the volume namedUbuntu
. Alternatively, you can use the command shown below.sudo cp /Volumes/mac-icns/os_ubuntu.icns /Volumes/Ubuntu/.
-
Rename the
os_ubuntu.icns
icon file to.VolumeIcon.icns
. This can be accomplished by entering the following command.sudo mv /Volumes/Ubuntu/os_ubuntu.icns /Volumes/Ubuntu/.VolumeIcon.icns
Note: Files starting with a period (
.
) do not normally appear in a Finder application window. -
Use the Finder application to eject the EFI System partition with the volume name
Ubuntu
. Alternatively, you can use the command shown below to unmount the volume.diskutil unmount disk0s3
Use the Finder application to eject the volume named
mac-icns
.
Adding a HFS+ Partition
Note: Below is based on the output from
diskutil list
that you provided in your question.
-
Enter the command below in a Terminal application window. The will create a "Mac OS Extended" volume named "Ubuntu" in a new partition.
sudo diskutil apfs resizeContainer disk0s2 242300M HFS+ Ubuntu 200M
-
Get the volume UUID for the volume named "Ubuntu" by entering the command below.
diskutil info Ubuntu | grep "Volume UUID"
The output should be similar to what is shown below.
Volume UUID: 795F14D2-ED1F-3CA0-A004-BD0A27000DC8
-
Next, prevent this new volume name "Ubuntu" from automatically mounting, by entering the following commands. Substitute your UUID for the one shown below.
sudo bash echo >> /etc/fstab echo UUID=795F14D2-ED1F-3CA0-A004-BD0A27000DC8 none hfs rw,noauto >> /etc/fstab exit
Note: The correct way, to edit the
/etc/fstab
file, is to use the commandsudo vifs
. Using theecho
command is just a quick shortcut. -
Use the Finder application to eject this new volume. Alternatively, you can enter the command shown below to unmount this volume.
diskutil unmount Ubuntu
If you need me to expand on any of the above steps, let me know.
Solution 2:
Original Answer
My second answer differs from this answer in the following ways.
- In the second answer, the second EFI partition is replaced by a HFS+ partition. This type of partition is easier to create and modify.
- In the second answer, the label displayed in the Startup Manager will be "Ubuntu" instead of the generic "EFI Boot".
I will assume the following:
- You have install Ubuntu to use the EFI boot method.
- You are using grub to boot Ubuntu
- Grub boots from the EFI partition.
- There is only one EFI partition.
- The EFI partition is the first partition on the Disk.
- There is only one disk involved and the disk is internal.
- rEFInd is installed in the EFI partition.
I will give two way to solve your problem. Each has it pros and cons.
The Mac Startup Manager will display an operating system if you place the .efi file in the right location. This location is the EFI/boot
folder of the volume in a EFI partition. The file name must be bootx64.efi
. Furthermore, you can customize the icon displayed for the operating system by placing a .VolumeIcon.icns
file in the root folder of the volume in the EFI partition.
The First Way.
Note: Here, rEFInd is still being used, but not as a replacement for the Startup Manager. You will be able to use a firmware password. In fact, no rEFInd menus are displayed. The rEFInd boot manager just silently boots grub (which boots Ubuntu).
- Download rEFInd from this SourceForge website. I assume the downloaded file is named
refund-bin-0.11.2.zip
and this file was downloaded to your~/Downloads
folder. - Create a new EFI partition. Instructions are given in the section "Adding a EFI Partition".
- Download the rEFInd Boot Manager software from this SourceForge web site.
-
Install rEFInd into the volume on the new EFI partition.
cd ~/Downloads/refind-bin-0.11.2 ./refind-install --usedefault /dev/disk0s3
-
Unmount and mount the new EFI partition, by entering the following commands.
diskutil unmount disk0s3 sudo diskutil mount disk0s3
The new EFI partition will have the volume name
EFI2
. -
Configure the TextEdit application. Open TextEdit, then navigate to the "Preferences..." window. Uncheck all the "Options", as shown below. When finished, quit TextEdit.
-
Use the command below to navigate to the folder containing the
refind.conf
file.cd /Volumes/EFI2/EFI/BOOT
Make a backup copy of this file.
cp refind.conf refind.conf.orignal
Open the file in the TextEdit application.
open -e refind.conf
-
In this volume, edit the
EFI/BOOT/refind.conf
file to silently boot grub (which will intern boot Ubuntu). This can be accomplished by adding the following lines to the end of therefind.conf
file. You should be able to just cut and paste these lines. When finished, save the changes, then quit TextEdit.# # Added to make rEFInd silent. # menuentry "Ubuntu" { icon \EFI\BOOT\icons\os_ubuntu.png volume "EFI" loader \EFI\ubuntu\grubx64.efi ostype Linux graphics on } timeout -1 hideui all scanfor manual
-
Unmount the new volume named
EFI2
.diskutil unmount disk0s3
Pros: Ubuntu is unaffected, so any Ubuntu updates will not require attention.
Cons: You need to use the third party boot manager rEFInd.
The Second Way.
- Create a new EFI partition. Instructions are given in the section "Adding a EFI Partition".
-
Mount the original and new EFI partitions, by entering the following commands.
sudo diskutil mount disk0s1 sudo diskutil mount disk0s3
The original EFI partition will have the name
EFI
and the new EFI partition will have the nameEFI2
. -
In the new volume named
EFI2
, create the foldersEFI/ubuntu
andEFI/boot
, by entering the following commands.mkdir -p /Volumes/EFI2/EFI/ubuntu mkdir -p /Volumes/EFI2/EFI/boot
-
Copy the files
grub.cfg
andgrubx64.efi
to the new volume namedEFI2
. The commands needed are given below.cp /Volumes/EFI/EFI/ubuntu/grub.cfg /Volumes/EFI2/EFI/ubuntu/grub.cfg cp /Volumes/EFI/EFI/ubuntu/grubx64.efi /Volumes/EFI2/EFI/boot/bootx64.efi
Pros: You do not need to use the third party boot manager rEFInd.
Cons: If the grubx64.efi
or grub.cfg
is updated, you have to manually copy these files to new volume named EFI2
.
Adding a Custom Icon
The steps below will add the following Ubuntu icon to the Startup Menu.
- Download a collection of icons from the sourceforge web site Mac icns.
- Use the Finder application to open the downloaded file
mac-icns.dmg
. I assume this file downloaded to your~/Downloads
folder. -
Mount the volume named
EFI2
by entering the following command.sudo diskutil mount disk0s3
-
Use the Finder application to copy the
os_ubuntu.icns
icon file to the root folder of the volume namedEFI2
. Alternatively, you can use the command shown below.cp /Volumes/mac-icns/os_ubuntu.icns /Volumes/EFI2/.
-
Rename the
os_ubuntu.icns
icon file to.VolumeIcon.icns
. This can be accomplished by entering the following command.mv /Volumes/EFI2/os_ubuntu.icns /Volumes/EFI2/.VolumeIcon.icns
Note: Files starting with a period (
.
) do not normally appear in a Finder application window. -
Use the Finder application to eject the EFI System partition with the volume name
EFI2
. Alternatively, you can use the command shown below to unmount the volume.diskutil unmount disk0s3
Use the Finder application to eject the volume named
mac-icns
.
Adding a EFI Partition
Note: Below is based on the output from
diskutil list
that you provided in your question.
While booted to macOS, enter the commands below in a Terminal application window.
sudo diskutil apfs resizecontainer disk0s2 242300M %EFI% n 200M
sudo newfs_msdos -F 32 -v EFI2 /dev/disk0s3
If you need me to expand on any of the above steps, let me know.