Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
EFI + gentoo-sources and grub
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
pegu
n00b
n00b


Joined: 19 Sep 2003
Posts: 53

PostPosted: Tue Oct 01, 2024 10:28 am    Post subject: EFI + gentoo-sources and grub Reply with quote

In https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks#Mounting_the_root_partition the following commands are given to create the /efi mount point in the rootfs:

Code:

root #mount /dev/sda3 /mnt/gentoo
root #mkdir --parents /mnt/gentoo/efi


Next in https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base#UEFI_systems the efi partition will be mounted on on /efi in the chroot environment:

Code:

root #mount /dev/sda1 /efi




In https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Compiling_and_installing it will install the compiled kernel in /boot:


Code:

make && make modules_install
make install


This will simply install the kernel in /boot which is a subdirectory of the rootfs. Shouldn't the kernel be installed in /efi?
When I try to run make install I get a message saying that it can't find LILO which is not selected anywhere in the process.

Code:

/usr/src/linux # make install
  INSTALL /boot
Cannot find LILO.



BTW, further up it's stated that "Installkernel may be used to automate the kernel installation." which indicate that this step is optional.


In https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#UEFI_systems grub is installed, which results in no errors:

Code:

/usr/src/linux # grub-install --efi-directory=/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.


The grub config will also be stored in the /boot directory on the rootfs according to https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#Configure

Code:

/usr/src/linux # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done


Now the kernel is in the rootfs and grub is on the efi partition. How does grub find the kernel?

When I boot this system I only get a single grub entry with "UEFI Firmware Settings". I can interrupt it and boot the system from the grub command line by setting the root and specify the location of the kernel and root partition.

Shouldn't the efi partition be mounted at /boot prior to "make install" in order for grub to find these? Or what steps have I missed or what is missing in the installation guide when using EFI and building the kernel from gentoo-sources?
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4900
Location: Bavaria

PostPosted: Tue Oct 01, 2024 11:35 am    Post subject: Reply with quote

Most of what you have written is completely correct, even if you doubt it. :lol:

Yes, it makes no difference whether you mount /efi BEFORE you chroot (with mount /dev/sda1 /mnt/gentoo/efi) or after you have changed via chroot (with mount /dev/sda1 /efi). Example: https://wiki.gentoo.org/wiki/User:Pietinger/Draft/Quick_Installation_OpenRC_for_an_UEFI_System#Mount_partitions

Until septermber 2023 the moutpoint for the ESP was indeed /boot. It was then changed to /efi. See more here: https://forums.gentoo.org/viewtopic-t-1165115-highlight-.html

Yes, this means that you mount the ESP on /efi, while /boot is an ordinary directory of the root directory (and thus located on the root partition).

GRUB consists of two parts. The first part can be started by UEFI and must therefore be on the ESP (exactly: \efi\gentoo\grubx64.efi). This part knows where the second part is located (this happens during the installation of grub with grub-install). The second part of grub is now located in /boot/grub (and thus on the root parttion). This second part reads the grub.cfg and now knows where the kernel is located.

If your grub does not find the kernel, it may be because the name of your kernel (in /boot) does not correspond to a standard and therefore the “grub-mkconfig” has not found a kernel (although there is one) and has not entered a kernel in the grub.cfg. This is exactly what your output from grub-mkconfig shows. I am missing a: “Found linux image: ...”

The installkernel influences the “make install” (via hooks) and therefore installkernel should be installed. Another possibility would be to copy the kernel itself (“make install” does nothing else). Have a look at this: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Cheat_Sheets

If you need more help, we would need the output of:

- ls -l /boot
- efibootmgr
- and the content of grub.cfg
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum