12

I installed win10 and a Linux for dual boot on the same ssd, during the installation of Linux, it contains a grub. After installation, I can see there is a new Linux efi file added to the ESP partition. Now I decided to remove the Linux entirely, the first step I did is to remove the efi boot entry with a tool called EasyUEFI. The entry disappeared when I reboot and pressing F11.

But there are 2 parts confused me:

  1. The Linux efi file is still in the ESP partition after the entry is removed, I thought existence of such efi files are how the UEFI would know if there is such boot option when user press F11 when booting. Now this means the boot options is recorded somewhere else, and the EasyUEFI tool simply removed that. Where is it, is it in ESP partition?

  2. I am not quite sure if I understand this right, are UEFI boot (the efi file and whatever other boot records it added during installation) and grub the same thing now? Or it’s when user select an efi boot entry, it goes to grub boot menu, which is a separate thing? If efi boot can handle the boot selection already, isn’t it pointless to have a grub after?

Than you

4
  • 1
    1 It's on your firmware, not ESP. 2 UEFI is your firmware and grub is an UEFI Application which can serve the bootloader functionality. UEFI can handle boot selection but can't boot every OS(it can only run UEFI Applications on the ESP, e.g, grub, Linux kernel with EFI stub code, modern Microsoft bootmgr), so it runs grub. Grub also provides its own boot menu and can boot more OSes(and much more other functionalities) than UEFI. Jun 13, 2019 at 11:16
  • 1
    2. "Isn't it pointless to have Grub?" No and yes. The role of the program loaded that is pointed to by the boot variable is to function as a boot loader for the operating system. It can also have auxiliary functions, like providing a boot menu. On the other hand, the Linux kernel can be configured so that the kernel image itself is a valid EFI binary which can boot itself. So, yes, using Grub with UEFI firmware is pointless, or at least not necessary. You can also use "boot managers" like systemd-boot or rEFInd, which are not boot loaders, just boot menu providers. Jun 13, 2019 at 12:44
  • Thank you, that's very helpful, now I get the picture.
    – kdlsw
    Jun 14, 2019 at 0:49
  • 1
    No, UEFI can't boot everything, it requires the kernel(or anything being used as boot stub for the OS) to be a UEFI Application and be located in ESP. Grub offers more flexible boot options, such as boot kernels from other partitions with non-FAT filesystems, follow multiboot protocol or linux boot protocol, chainloader to MBR of another disk, etc. Jun 14, 2019 at 6:07

1 Answer 1

10

1.) With EasyUEFI, you'll be editing the UEFI boot variables. These are stored in system NVRAM, just like BIOS settings. In Linux, you can edit them with the efibootmgr utility; in plain Windows, bcdedit /enum FIRMWARE can list them and other options can be used to edit them.

If there is no boot variable defined, there is a specific fallback path UEFI looks at automatically: for 64-bit x86 hardware, this path is \EFI\boot\bootx64.efi. If this file exists in an ESP partition or in any FAT32 removable media, the disk or other media is automatically considered "bootable" in native UEFI style.

2.) UEFI is system firmware (like BIOS, but newer). GRUB is a bootloader, so it must conform to whatever form is expected by the firmware of the relevant hardware architecture, or else the firmware will not be able to load GRUB.

So, the core of GRUB can take many forms: with BIOS, GRUB takes the form of a bit of boot code in MBR + more code embedded into disk blocks between the MBR and the beginning of the first partition. With UEFI, the core of GRUB (or even all of it) can take the form of a single grubx64.efi file within the ESP partition.

GRUB has its own architecture identifiers: the version of GRUB for BIOS is known as the i386-pc version, and the UEFI version on 64-bit x86 hardware is known as the x86_64-efi version. If you're, for example, imaging an old system and restoring the image to new hardware, and you'll find that the new system uses different firmware style (i.e. the old system used traditional BIOS and the new will be UEFI), then you'll usually have to add the ESP partition, replace the i386-pc version of the GRUB package with the x86_64-efi version and then reinstall GRUB.

You must log in to answer this question.

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