hello,

I don’t know if this is the right place to ask this question but could someone explain me how a UEFI system boots, I couldn’t find a guide online. I want to know because I don’t understand certain GRUB commands and how it get installed.

I just copy paste commands from Arch wiki and it just magically works without me knowing anything about it.

all the different distros use different grub command parameter and it’s so confusing. eg, Arch and Gentoo.

Arch command: grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB Gentoo command: grub-install --efi-directory=/efi

why both command is different? exactly where does grub gets installed?

sorry if this is a naive question but i really don’t understnad GRUB.

  • [TK] Trainzkid@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    15 hours ago

    When I’m confused about commands, I find checking the man page for the command a good start to understand what the flags do. Once you’ve got man-pages installed on your Linux system, you can do “man grub-install” (or any other command) from a terminal to see information about that command and it’s flags.

    I’m not sure if it says it in the Arch wiki, I think it might, but “esp” is often shorthand for whatever directory you’re using as an EFI boot directory, I don’t think it’s a literal directory. On my Arch system, my esp is “/boot/EFI” I’m pretty sure.

    As for why Gentoo doesn’t include the --target flag, it could be that “x86_64-efi” is either the default on gentoo’s version of grub, or just the default for every version of grub, meaning if the latter is the case, that flag could be safely omitted for your arch installation.

    I’m pretty sure the --bootloader-id flag is just a friendly name for the bootloader that you can see from the terminal when booted into a Linux system and probably also from the bios menu. I’m not 100% though, a check through the man page would tell you more about that specific flag. Gentoo may omit it, leaving it either blank, or as some sort of default.

    To answer your original question, the system boots up, does some basic checking of hardware to make sure everything can run okay and that there are no obvious faults or incompatibilities, then tries to load a program called a “bootloader” (such as grub), which will then hand off execution to whichever operating system you select. If you’re not fond of grub, good news! There are plenty of other good bootloaders available. I’m a big fan of rEFInd (UEFI only) or systemd-boot.

    I don’t know grub SUPER well, but I’m pretty sure it gets installed in that --efi-directory location that you provide when you run the command. It might be nested a few directories down though, not sure.