On 4/16/23 05:16, Mitch D. wrote:
When you emerge grub, Gentoo compiles and "installs" grub (and some 
grub-related tools) to a directory inside your Gentoo installation, just like other 
applications. The catch is that grub isn't like other applications... it needs to run 
outside of Gentoo, before Linux starts. This means that Grub isn't very useful sitting 
inside your Gentoo installation.

"grub-install" copies Grub from your Gentoo installation to your hard drive / 
SSD / etc. This has nothing to do with your kernel, it only involves Grub. Rerun this 
command when you emerge updates to Grub.

"efibootmgr" tells your motherboard's (U)EFI firmware where to find Grub (or 
any other bootloader or EFI tool). When you emerge an update for Grub (and run 
grub-install), the path shouldn't change, so there's no need to rerun efibootmgr. This 
also has nothing to do with your kernel.

"grub-mkconfig" generates a configuration file that Grub reads while the computer is 
booting, and generally tells Grub what options to include in the menu Grub displays. When you 
update your kernel, you want to update that menu, so you SHOULD rerun "grub-mkconfig" at 
this time.

All EFI systems are supposed to have an EFI system partition (ESP). Some people 
use the ESP as their boot partition, while other people keep them as two 
separate partitions and mount the boot partition as /boot and the ESP as 
/boot/EFI. Either way, it's not related to dual-booting.

NOTE: if I remember correctly, there are USE flags that can be enabled to 
automatically run grub-install and grub-mkconfig when updates are installed for 
Grub and for kernels, respectively.

-Hypoon

On Sun, Apr 16, 2023, 00:19 <[email protected] 
<mailto:[email protected]>> wrote:

    On 4/15/23 22:01, [email protected] <mailto:[email protected]> 
wrote:
     > After installing new kernel how to update /boot EFI directory?
     >
     >  From my notes, I have:
     > grub-mkconfig -o /boot/grub/grub.cfg
     > grub-install --target=x86_64-efi --efi-directory=/boot
     >
     > or should it be:
     > grub-mkconfig -o /boot/grub/grub.cfg
     > efibootmgr -c -d /dev/nvme0n1p1 -p 1 -L "Gentoo" -l 
/boot/grub/x86_64-efi/core.efi
     >
     > Boot partition is:
     > /dev/nvme0n1p1   =  /boot

    This is not dual boot system, so I don't know why /boot has EFI directory

Thank you Hypoon and folks for detail explanation.  Always learn something new.
So once EFI is installed during grub installation there is no need to touch it, 
by running:

grub-install --target=x86_64-efi --efi-directory=/boot

And thanks Lee for a hint about booting kernel manually from grub command line.
I'll definitely look it up and make some notes.
Anybody can share more information on it.

And NO, I'll not look check ChatGPT, don't want to end up with unbootable 
system :-)


Reply via email to