Standalone Grub2 EFI installation - grub.cfg placement?
Solution 1:
GRUB 2 binaries include hard-coded references to their configuration files. I haven't really been keeping track of all the gory details, but as I understand it, there are two EFI GRUB 2 binaries for Ubuntu on AMD64/x86-64 systems:
-
grub2-efi-amd64
-- This is the version of GRUB 2 that's used on computers that do not use Secure Boot. As I understand it, the binary itself is linked on your computer from pre-compiled components included in the package. The resulting binary refers to agrub.cfg
file on your Linux installation's/boot/grub
directory. Thus, you can't use thegrubx64.efi
binary installed from this package on one computer on another one, because the binary is customized for the computer on which it was created. -
grub2-efi-amd64-signed
-- This version of GRUB 2 is compiled and linked on a Canonical system so that it can be signed with a Secure Boot key. One side effect of the requirement that the binary be signed is that it cannot be customized for your system, and as a result, this version ofgrubx64.efi
looks in the same directory as the binary forgrub.cfg
. On an Ubuntu system, thisgrub.cfg
file searches for/boot/grub/grub.cfg
, but in principle it could be customized to do something else.
Thus, in your case you can't use the unsigned GRUB 2 binary; if you want to use a stock Ubuntu GRUB 2 binary, you must use the signed one. Alternatively, you could build your own binary, as described here, among other places.
In your case, though, I don't think GRUB 2 is really optimal. Both rEFIt (which is now abandoned) and my fork of it, rEFInd, feature dynamic scanning for available boot loaders. Thus, if you install rEFIt or rEFInd to your internal disk's EFI System Partition (ESP) and put the boot loaders for your OSes on their respective removable media, rEFIt/rEFInd will provide you with options to boot those OSes if and only if the appropriate disk is plugged in. This behavior, however, will depend on proper management of your boot loaders, placing each one on the ESP of its respective disk; if your boot loaders are all stored on your internal disk's ESP, rEFIt/rEFInd will show non-functional OS options at all times, just like GRUB 2 would. In either case, using rEFIt or rEFInd will obviate the need to delve into the morass of manual GRUB 2 configuration.
Solution 2:
I would expect that a grub.cfg placed in the same directory is read and executed by a GRUB UEFI image with both of them usually being stored on the ESP, but I don't know that much about Mac setups. (On another note the embedded configuration has very limited functionality.)
May be creating the GRUB image yourself without an embedded configuration brings you one step further to a solution, these posts might help:
- 2.1. Creating the binary and 2.2. Creating the configuration file in How to create UEFI-only bootable USB live media?
- Add a (boot) partition for Macs