Page 1 of 1

Solved: Grub bootloader problem in gpt environment

Posted: Mon Apr 21, 2025 8:10 am
by MichaelFarthing
Hello all,

I'm happy to be back here after a gap of nine years - retirement has given me hobby space back!

Previously I have used grub(2) to chainload my operating system in an mbr environment.
I am now trying to do this using grub in a gpt environment with the following menuentry:

Code: Select all

#   Lines below commented out as the modules have been pre-included in the main grub efi file
#    insmod part_gpt
#    insmod part_msdos
#    insmod all_video
#    insmod ext2
#    insmod gzio
#    insmod bli
insmod chain

set timeout_style=menu
set timeout=50

# other (working) linux menuentries occur here

menuentry "Lyra Ndlazi OS" {
  root=(hd0,gpt3)
  chainloader  +1
}  
This is giving me the unhelpful message "invalid EFI file path" This is being generated by the chainloader command (checked by running the entry in grub's command line environment). I have also tried with the (supposed?) chainloader --force option, which simply complains that --force is not a file. The gpt partition header uses my os's private type uuid and has the boot legacy attribute bit set. The root=(hdo,gpt3) has also been checked in the grub command line to ensure that it does reflect the way grub is seeing things. I have also checked (using active disk editor) that the efi partition points correctly to the actual partition start where is located a traditional vbr, but the error message makes it look certain that the vbr is not being reached, so cannot be blamed for the failure, bit it does in any case have a correct signature.

Extensive google searching has revealed this as a common problem in loading windows, but suggested solutions seem to centre round Windows's fussiness about what partition it occupies

Can anyone offer me any clues as to what is wrong?

Michael Farthing

Re: Grub bootloader problem in gpt environment

Posted: Mon Apr 21, 2025 9:22 am
by iansjack
Why not just make your kernel a multiboot application and load it directly from GRUB rather than chain loading another bootloader?

Re: Grub bootloader problem in gpt environment

Posted: Mon Apr 21, 2025 12:46 pm
by Octocontrabass
MichaelFarthing wrote: Mon Apr 21, 2025 8:10 am"invalid EFI file path"
When you boot GRUB in legacy BIOS/CSM mode, the chainloader command only supports legacy BIOS boot sectors.

When you boot GRUB in UEFI mode, the chainloader command only supports EFI executable binaries.

You're booting GRUB in UEFI mode.

(By the way, this has nothing to do with GPT. You'd see exactly the same error if you were using a MBR disk in UEFI mode.)

Re: Grub bootloader problem in gpt environment

Posted: Fri Apr 25, 2025 4:18 am
by MichaelFarthing
Thanks both - back to the drawing board! For now I think I'll settle for a very dirty hybrid and a concocted MBR. Very ugly, but I can get back to work on more interesting stuff.

Octocontrabrass - shame you didn't write the grub manual!