MacBook Air with Bootcamp, wanting removable Linux devices without rEFInd

bootcamppartition

Most of the questions here similar to my question regard triple booting and using rEFInd, which I'm not trying to do.

My Mac drive is only 128GB, and I've cut into that with Bootcamp, so I'm looking to boot Linux distros via microSD. So far, I've only gotten a Chrome OS on a microSD workable from the Mac's boot menu, but I'm failing to get Ubuntu.

This mentions something similar: Linux on Macbook, dual-boot, without rEFind, but it's for Dual boot. I did try taking their advice of copying the ../ubuntu/grubx64.efi to ../boot/bootx64.efi, but the results were goofy. With the microSD inserted, the boot menu still only displayed MacBook and Windows, and when selecting Windows, I got the MokManager error, but it still booted into Ubuntu anyway after leaving it for about 30 seconds. When removing the microSD and booting to that volume, Windows boots to the Grub bash screen. The only way I've found to fix this is to replace bootx64.efi with the Windows version. Basically the same problem you run into after installing Linux to an external drive when Bootcamp is already using that EFI folder.

When I installed Ubuntu to the microSD (/dev/sdc), I also installed the grub bootloader to the sdc volume which I was installing Ubuntu on, so that the bootloader did not damage my Mac OS or Windows boot processes.

I have tried deleting the Secure Boot option (shimx64.efi) to deal with this, but that causes Ubuntu to fail to boot anymore from microSD. So does replacing the Windows/bootmgfw.efi -> boot/bootx64.efi, although that lets me boot Windows again.

Of course, I'm trying to get it so that a separate menu item that says "Ubuntu" (and all future distros) when inserted, as I'd like to make use of other microSDs and USBs for the same purpose.

How should I go about altering the EFI folder and items, without causing Bootcamp to fail? (I've already mucked up that boot several times when testing different options, so I keep restoring from a backup folder.)

Is there a file in the EFI folder I need to edit to add volumes to be added to the boot menu?

Best Answer

IMO, a micro SD is not designed for the amount of read/writes that would occur when an operating system such as Ubuntu is installed. However, other users have posted questions where this is what they have done. So, I assume do so is feasible.

The Ubuntu installer does allow selection of where to put the Grub boot files. However, my experience has been the installer ignores any such selection and installs the Grub boot files in the first EFI partition on /dev/sda. From the description of the problems you are having, I assume this is true for your installation. Perhaps you meant the rest of the Grub files were installed in the /boot folder on the micro SD card (/dev/sdc).

An answer explaining how to separate the Windows boot files from the Ubuntu (Grub) boot files has already been posted here at Ask Different.

I should point out the BOOTX64.EFI file provided by the Ubuntu installer is the file the Mac Startup Manager finds and causes an icon to be displayed. This file is not a duplicate of the grub boot file grubx64.efi, but is instead a duplicate of the shimx64.efi file. My experience has been booting by using this file works, but do so also makes Ubuntu the default startup operating system.

Changing the label for the icon displayed on the Mac Startup Manager boot menu from the default of EFI Boot can be accomplished by using the macOS bless command. See the question How can I change the title of a boot image?. In your case, you should specify the folder containing the BOOTX64.EFI file.

There is no file in the EFI folder that can be edited to add volumes to the Mac Startup Manager boot menu. Instead additional items can be added by creating additional EFI partitions. Newer Macs firmware has been extended to include any Microsoft Basic Data partition which has been FAT or ExFAT formatted. Each partition needs to contain a EFI/BOOT/BOOTX64.EFI file. I should also point out that there exists other configurations that will result in a icon being displayed on a Mac Startup Manager boot menu.

The icon displayed on a Mac Startup Manager boot menu can also be customized by adding a .VolumeIcon.icns file to the root folder of the volume contained by the EFI partition. Care must be taken to insure the .VolumeIcon.icns file is of a format compatible with the firmware on the Mac logic board. Prebuilt icon set (.icns) files can be downloaded from this site. Also, included is script for creating new icon set files.