Install Grub2 to support BIOS and UEFI at the same time

Hello!
My Silverblue is installed on an external USB SSD, to permit me to easily connect it to my laptop, or desktop, or at works, macbook, etc…
I have a new device, a chromebook, there is a hack to boot on external USB but for my model it’s restricted to legacy BIOS.
So, I’m searching a solution to install GRUB on the MBR.
I’ve tried this command:
# LANG=C grub2-install --target=i386-pc /dev/sdb
Installing for i386-pc platform.
grub2-install: warning: …/grub-core/partmap/gpt.c:192:this GPT partition label contains no BIOS Boot Partition; embedding won’t be possible.
grub2-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged…
grub2-install: error: will not proceed with blocklists.

I need to put the option --force to permit to install it.
This works partially, I can now boot but there is directly the EFI/Grub shell> prompt.

On my previous USB Key with Fedora 29, I’ve tried the same command ( after installed grub-customizer for missing libraries), and it’s a little bit better because I can see my grub menu with all my options, but can’t really boot on it ( error: can’t find command ‘linuxefi’ / ‘initrdefi’ )

If someone have any idea and competences in grub, this could be much appreciated ! :slight_smile:

GRUB can only do one or the other, not both. In the latter case it sounds like the grub config was written for uefi but running on mbr grub, try editing the boot options (e) to remove the efi from “linuxefi” and “initrdefi”, then cross your fingers :crossed_fingers:

Thanks again for your help @refi64 ! it 's not works, but nevermind, I’ll return back the Chromebook, and use a UEFI comptabile device!

Have you checked out Crostini? If what you really want is just a Fedora experience instead of Debian (the default), I’ve been working on Fedora packages for the guest tools on the side (was debating getting a Pixel Slate for a bit).

My eventual goal was to figure out some way to run GNOME Shell on the host, windowed, since Crostini seems to pretty aggressively capture key presses.

I’ve returned the chromebook, but it’s good to known you works on that !

Grub absolutely can be installed twice, once in BIOS and once in UEFI mode. We do this on Container Linux and I’m working on doing this on Fedora CoreOS. In UEFI mode, grub is entirely contained as an EFI executable. In bios mode it’s installed in two places: the MBR which has just enough code to load the second part which is installed in the “bios boot partition” (determined by a GPT type guid). Your initial error is grub complaining you have no such partition to put the second part of grub.

Then there’s the issue of grub configs. By default grub uses grub2-mkconfig to generate a config that works for one or the other but not both. The grub commands for loading linux and initrds differ (I think, don’t quote me on that) between bios and efi. I’d recommend switching to using the bootloader specification snippets and writing out a grub config that just calls blscfg which will detect which mode it’s in and write out the menu entries that are correct either way.

2 Likes

Thanks @ajeddeloh for theses precisions ! :slight_smile:
This could be a good idea to have BIOS and UEFI boot modes at the same time on Silverblue, as for CoreOS / Container Linux !