I've got a laptop configured to dual-boot Windows 10 and Gentoo that I want to add an Ubuntu installation to so that I can do firmware updates (the OEM currently only supports handling of firmware updates on Ubuntu and Ubuntu derivatives).
In this particular case, I'm not directly using the UEFI boot manager other than having it load GRUB2 both because the system in question doesn't provide the option of a menu with a timeout (you have to hit F12 to get a boot menu, and it sits there until you select something), and because I want passwords on some boot options but not others (and Windows is one of the things I want a boot password for). I would like to keep this setup and integrate Ubuntu into it, instead of having to deal with the (crappy) UEFI boot manager interface when I want to boot Ubuntu, which in turn means I need a way for Ubuntu to not mess with the UEFI boot manager variables (fighting with Windows every time it gets upgraded to a new build is bad enough without another OS contending for control).
Based on what I've seen so far it looks like the only way to do this is to do a non-EFI install of Ubuntu, and then pull in the grub-efi
package manually (and probably do some trickery to keep efibootmgr
from being run). Is there any other way to do this without needing to create a custom installer or custom grub-efi
package?
You have the right idea, and all the pieces in place, assuming you don't want secure boot enabled (which would take the ...signed versions of the kernel...). Just install Ubuntu in legacy mode, no UEFI variables are touched, no UEFI files/directories are created. Reboot Gentoo and run sudo update-grub to pick up the Ubuntu installation in the grub menu. Now you can boot the Ubuntu installation in UEFI mode -- it doesn't need another UEFI grub, you've already got one. If you want, you can actually add the fstab entry to mount the EFI partition at /boot/efi, but really, without a grub-efi, why bother (note, I have a system which I did exactly the above, but I did add the fstab entry, in case I ever wanted to install the grub-efi (I never did install it)..).
The system I am running has a legacy Windows/Ubuntu on disk one, and an UEFI Ubuntu on disk 2. I install Disk 2 in legacy mode,manually creating an EFI partition, which I populated from a backup off another system. One edit of the UUID in the grub.cfg stub to pick up the maintained /boot/grub/grub.cfg, and the second disk boots in UEFI mode by selecting the disk. In your case, your existing installations are already in UEFI mode, so the existing grub can do everything.