As I understand it, the uefi bios loads grub.efi from the efi partition. This now loads a bunch of grub modules and the configuration file from the /boot directory.

But how does grub find the correct device in which the boot partition resides? In grub legacy, you'd usually install grub to a specific partition, using

# grub-install --root-directory=/dev/sda

So it's quite clear where it will look for the boot directory. How does grub-efi figure out the correct device?

  • as I understand it, the configuration for the location of the kernel is in the efi partition.
    – Joe
    Commented Mar 5, 2016 at 8:04
  • Clearly the information has to be in the efi partition, but you never really specify it at any point (like you used to have to) when installing grub.
    – user128063
    Commented Mar 5, 2016 at 8:06
  • in the .efi file that is generated when you run grub-efi
    – Joe
    Commented Mar 5, 2016 at 8:08

1 Answer 1


After using ghex to examine my "BOOTX64.EFI" file in the efi partition I found this line.

search.fs_uuid a43d1f11-6ebe-477d-8be3-321a33bc37f9 root hd2,gpt4 
set prefix=($root)'/boot/grub'

This shows that the information for the location of grub (the boot partition) has been embedded by grub2-install into the BOOTX64.EFI file generated for the system.

Grub2 is then executed by the EFI loader and you get the grub interface to choose the operating system (kernel) to boot into or the default kernel is loaded.

Just to expand a bit: ".EFI" files are kind of like applications that the UEFI subsystem can execute. Intended to be used to both boot the system and provide a convenient place to run execution protection and anti-virus type programs.

They put the extensible in "Unified Extensible Firmware Interface"

  • It would be interesting to see if you could patch this file and change your configuration and uuid's and still boot without reinstalling Grub
    – Joe
    Commented Mar 5, 2016 at 8:31
  • Weird, I'm not able to find it. My ubuntu efi directory has a grub.cfg (in ascii) with the prefix and root information inside id. But my archlinux efi directory simply has a grubx64.efi that has no sign of the root and prefix commands you mentioned even when I read them in ghex.
    – user128063
    Commented Mar 5, 2016 at 17:44
  • Not in ubuntu.efi look for boot.efi. the efi partition has a folder. Called efi and in it a folder called boot.
    – Joe
    Commented Mar 7, 2016 at 7:40
  • 1
    Oh, sorry I misread your previous post. Stackexchange cut off your previous post at the part where you described your system. Your description is of a single bootloader (grub) image (BOOTX64.EFI) that boots two operating systems as far as I can tell. Here are a few more possibilities: 1) steamos could also have it's own separate bootloader, for which it would have its own EFI file in the efi partition. 2) you have a hybrid EFI-legacy boot system where your steamos bootloader is stored in the MBR. You can see the efi bootorder is to use sudo efibootmgr -v on gentoo, but I'm sure you know this
    – user128063
    Commented Mar 9, 2016 at 7:30
  • 1
    It was the main mystery about mechanism of booting. How this jump to grub.cfg implemented? Very simple: binary has UUID and path to place where grub.cfg exists. You helped me a lot. Thank you! Commented Feb 3 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .