9

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
  • What is the year of your MacBook Air? What i really want to know is how is Windows, Ubuntu and rEFInd installed. Do any BIOS boot? Where did you install rEFInd? Also, it would help if you included the output from the diskutil list command. Your question has been asked before. There are several simple solutions. – David Anderson Dec 29 '17 at 19:46
  • There are, indeed, several solutions, but none of them work for me. The year of the MacBook Air is 2017. I first installed Windows with bootcamp, shrank the macOS volume to make another data volume for Windows, installed Ubuntu by shrinking the macOS partition again (which broke things and I had to reinstall macOS and reset the Windows data partition). I installed rEFInd afterwards from the official website. diskutil list output: Pastebin – kouwei32 Dec 29 '17 at 19:52
  • 1
    You probably should have read this first: Installing Ubuntu on Mac with macOS and Windows already installed. I am currently posting an answer to your question. My answer is based somewhat on the above link. – David Anderson Dec 29 '17 at 20:25
  • Reboot your Mac and execute the command diskutil list. Replace the output in your answer with this new output. I ask this because disk0s3 is missing in your presently displayed output. – David Anderson Dec 31 '17 at 11:40
4

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).

  1. 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.
  2. Create a new HFS+ partition. Instructions are given in the section "Adding a HFS+ Partition".
  3. Mount the new HFS+ partition, by entering the following command.

    sudo  diskutil  mount  disk0s3
    

    The new HFS+ partition will have the volume name Ubuntu.

  4. 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.

  5. Configure the TextEdit application. Open TextEdit, then navigate to the "Preferences..." window. Uncheck all the "Options", as shown below. When finished, quit TextEdit.

    y1

  6. 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 the refind.conf file.

    sudo  chmod  a+w  .  refind.conf
    

    Open the file in the TextEdit application.

    open  -e  refind.conf
    
  7. 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 the refind.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
    
  8. 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.

  1. Create a new HFS+ partition. Instructions are given in the section "Adding a HFS+ Partition".
  2. 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 name Ubuntu.

  3. In the new volume named Ubuntu, create the folders EFI/ubuntu and System/Library/CoreServices, by entering the following commands.

    mkdir  -p  /Volumes/Ubuntu/EFI/ubuntu
    mkdir  -p  /Volumes/Ubuntu/System/Library/CoreServices
    
  4. Copy the files grub.cfg and grubx64.efi to the new volume named Ubuntu. 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
    
  5. 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.

os_ubuntu.png

  1. Download a collection of icons from the sourceforge web site Mac icns.
  2. Use the Finder application to open the downloaded file mac-icns.dmg. I assume this file downloaded to your ~/Downloads folder.
  3. Mount the volume named Ubuntu by entering the following command.

    sudo  diskutil  mount  disk0s3
    
  4. Use the Finder application to copy the os_ubuntu.icns icon file to the root folder of the volume named Ubuntu. Alternatively, you can use the command shown below.

    sudo cp  /Volumes/mac-icns/os_ubuntu.icns  /Volumes/Ubuntu/.
    
  5. 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.

  6. 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
    
  7. 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.

  1. 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
    
  2. 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
    
  3. 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 command sudo vifs. Using the echo command is just a quick shortcut.

  4. 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.

  • 1
    This one works for me perfectly! Thanks! Also, it's not really good to use TextEdit for the config editing, for that it marks the config file as locked. I used sudo nano /Volumes/Ubuntu/System/Library/CoreServices/refind.conf to bypass this issue. – kouwei32 Jan 3 '18 at 8:13
  • kouwei32: It is good when someone can verify my steps. I added a command to change the permissions so the TextEdit application can be used. And yes, nano is a good substitute. – David Anderson Jan 3 '18 at 10:27
  • @DavidAnderson Thank you very much! This was key to having all three OSs booting fine. Without the 2nd EFS partition, it was only possible to boot to [macOS or Ubuntu] OR [Ubuntu or Windows, via GRUB], depending on how the hybrid MBR was set and whether I chose to hide the main APFS partition. Do you know why this is the case? Even with rEFInd, there was no single instance where the 3 OSs were bootable ... until I added the second EFS partition and followed the steps in First Way. – igordcard May 20 '18 at 19:51
  • @igordcard: I did make some corrections after reading your comment. Note: Since I posted this answer, Ubuntu no longer boots the same way. Therefore, my answer may not work, if you are using Ubuntu 18. Macs built in 2017 no longer contain a BIOS, therefore there is no need for a hybrid MBR. In fact, a hybrid MBR would prevent Windows from booting. I am not sure what you mean by "hide the main APFS partition". – David Anderson May 21 '18 at 5:57
  • @igordcard: Intel Macs are designed to boot either OS X, macOS or Windows. However, the firmware also allows for booting an operating system, if the operating system's boot files are installed using the specifications in section 3.5.1.1 Removable Media Boot Behavior on page 91 of the Unified Extensible Firmware Interface (UEFI) Specification. For Intel Macs, the media does to have to be removable. – David Anderson May 21 '18 at 6:20
1

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).

  1. 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.
  2. Create a new EFI partition. Instructions are given in the section "Adding a EFI Partition".
  3. Download the rEFInd Boot Manager software from this SourceForge web site.
  4. Install rEFInd into the volume on the new EFI partition.

    cd  ~/Downloads/refind-bin-0.11.2
    ./refind-install  --usedefault  /dev/disk0s3
    
  5. 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.

  6. Configure the TextEdit application. Open TextEdit, then navigate to the "Preferences..." window. Uncheck all the "Options", as shown below. When finished, quit TextEdit.

    y1

  7. 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
    
  8. 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 the refind.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
    
  9. 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.

  1. Create a new EFI partition. Instructions are given in the section "Adding a EFI Partition".
  2. 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 name EFI2.

  3. In the new volume named EFI2, create the folders EFI/ubuntu and EFI/boot, by entering the following commands.

    mkdir  -p  /Volumes/EFI2/EFI/ubuntu
    mkdir  -p  /Volumes/EFI2/EFI/boot
    
  4. Copy the files grub.cfg and grubx64.efi to the new volume named EFI2. 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.

os_ubuntu.png

  1. Download a collection of icons from the sourceforge web site Mac icns.
  2. Use the Finder application to open the downloaded file mac-icns.dmg. I assume this file downloaded to your ~/Downloads folder.
  3. Mount the volume named EFI2 by entering the following command.

    sudo  diskutil  mount  disk0s3
    
  4. Use the Finder application to copy the os_ubuntu.icns icon file to the root folder of the volume named EFI2. Alternatively, you can use the command shown below.

    cp  /Volumes/mac-icns/os_ubuntu.icns  /Volumes/EFI2/.
    
  5. 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.

  6. 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
    
  7. 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.

  • Unfortunately, the first solution is not the one that I wanted, and the second one doesn't work at all. – kouwei32 Dec 30 '17 at 21:09
  • The second solution is based on proven solutions I previous posted. Many other users have successfully used this solution. See here and here. – David Anderson Dec 30 '17 at 22:10
  • 1
    Perhaps I did not give enough details. For example, in your case, you will need to create a new EFI partition. This can not be a normal FAT32 formatted partition. This must be a EFI partition where the GUID in the GPT is C12A7328-F81F-11D2-BA4B-00A0C93EC93B. – David Anderson Dec 30 '17 at 22:16
  • I have a EFI partition already. Tried 3 times and no avail. – kouwei32 Dec 30 '17 at 22:18
  • You can have as many EFI partitions as you need. In your case, Windows is already using the EFI/boot folder in your EFI partition. This is why you need a second EFI partition. – David Anderson Dec 30 '17 at 22:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .