Add custom grub.cfg to /boot/efi/EFI/fedora

Hi… my question is building on top of CoreOS assembler: How to make changes to grub.cfg? &

Whenever I build a new FCOS with “my” adapted coreos-assembler (with the changed grub.cfg), it creates an iso image which is installable on BIOS and EFI systems, but the grub2 stuff only works for BIOS systems, because grub.cfg and grubenv is located in /boot/grub2 instead of /boot/efi/EFI/fedora…and also the symlinks are missing… This results in not executing the grub code at boot time (because it is not found in efi context)…

Now to the question: Can someone give me a hint how to make the image build in a way, that grub files are located correctly in the efi directory? Do I have to change something in coreos-assembler or in config repo or somewhere else?

Thanks again - also for your great work!!

There are several things going on here and multiple grub.cfg files. There exists:

  1. The non-live system grub.cfg embedded in our disk images.
  2. The live ISO grub.cfg, used for EFI boot off the ISO (typically for installs on bare metal).
  3. The live ISO isolinux.cfg, used for BIOS boot off the ISO (typically for installs on bare metal).

For the Live ISO EFI boot you’ll need to edit the 2nd one.

1 Like

It is about the 1st one, which is located and customized in coreos-assembler src directory. The problem is that after cosa build metal (and iso image), and an bare metal (or VM installation), the grub.cfg is in /boot/grub2 and not in /boot/efi/EFI/fedora…

I see some harcoded stuff in (coreos-assembler/src) on line 343:
local vendordir="{target_efi}/EFI/{vendor_id}"
mkdir -p "{vendordir}" cat > {vendordir}/grub.cfg << ‘EOF’
search --label boot --set prefix
set prefix=($prefix)
configfile $prefix/grub2/grub.cfg

which creates me the grub.cfg loading the one in /boot/grub2…

…but when I compare with a Fedora IoT installation, the “master” grub.cfg should be in /boot/efi/EFI/fedora and also its grubenv blockfile (which is symlinked from /boot/grub2)…

I guess it gets too “hacky” when i edit the script;-)

so there are no ways to modify the grub once the OS is installed?