Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
efi boot drive (solved)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mega_flow
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2016
Posts: 95
Location: Belgium

PostPosted: Fri Jul 12, 2024 6:47 pm    Post subject: efi boot drive (solved) Reply with quote

Hi
Question i use efistub too boot my system and use a custom install script to copy the kernel and bzimage to it location.
This 1 also mount and umount my /boot/EFI , but now installkernel quit when /boot/EFI is not mount. this is a new behavior of installkernel

this is the script is use
Code:
#!/bin/sh

#Install Script for kernel files in /etc/kernel/postinst.d

# Mount EFI
mount /boot/EFI

# Backup files
cp -R -v "/boot/EFI/bootx64.efi"  "/boot/EFI/efi/boot/bootx64.efi"

# Install New
cp -R -v "/usr/src/linux/arch/x86/boot/bzImage" "/boot/EFI/bootx64.efi" || die "Install failed!"
cp -R -v "/usr/src/linux/arch/x86/boot/initrd" "/boot/EFI/initrd.img" || die "Install failed!"
cp -R "/usr/src/linux/System.map" "/boot/EFI/System.map" || die "Install failed!"

# Umount EFI
umount /boot/EFI

# End


this is the error installkernel show

Code:
 * Your /boot/EFI partition is not mounted
 * Please mount it and retry.
 * /boot/EFI not mounted
 *
 * The kernel was not deployed successfully. Inspect the failure
 * in the logs above and once you resolve the problems please
 * run the equivalent of the following command to try again:
 *
 *     emerge --config '=sys-kernel/gentoo-kernel-6.6.35:6.6.35'
 * ERROR: sys-kernel/linux-firmware-20240709::gentoo failed (postinst phase):
 *   Kernel install failed, please fix the problems and run emerge --config
 *
 * Call stack:
 *     ebuild.sh, line  136:  Called pkg_postinst
 *   environment, line 1950:  Called dist-kernel_reinstall_initramfs '/usr/src/linux' '6.6.35-gentoo-dist'
 *   environment, line  783:  Called dist-kernel_install_kernel '6.6.35-gentoo-dist' '/usr/src/linux/arch/x86/boot/bzImage' '/usr/src/linux/System.map'
 *   environment, line  767:  Called die
 * The specific snippet of code:
 *           die "Kernel install failed, please fix the problems and run emerge --config";


installkernel wont copy any thing to /boot/EFI so why want it to force mee to keep this dir mounten
Can i force installkernel to keep going when emerge --config gentoo-kernel is executed

Moderator note: Changed some broken formatting --Banana
_________________
default/linux/amd64/23.0/no-multilib/gnome/systemd gnome:46


Last edited by mega_flow on Sat Jul 13, 2024 5:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1720
Location: Germany

PostPosted: Fri Jul 12, 2024 9:07 pm    Post subject: Reply with quote

You do mention installkernel. Is this it what you use? https://wiki.gentoo.org/wiki/Installkernel

If so, please have a look at the layout section: https://wiki.gentoo.org/wiki/Installkernel#layout
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Sat Jul 13, 2024 10:51 am    Post subject: Reply with quote

Quote:
this is a new behavior of installkernel


It is new behaviour of the mount-boot eclass (i.e. post install of the distribution kernel) not of sys-kernel/installkernel. There is no reliable way for portage to know beforehand what /sbin/installkernel is going to do, hence it enforces that all partitions it could need are mounted (/boot and the ESP).

To resolve your problem simply mount the EFI System partition at the mount point specified in /etc/fstab.

That being said, you probably don't need your custom script any more. /sbin/installkernel is now capable of installing the kernel to the ESP if layout=efistub is configured in installl.conf. This is the default configuration if the "efistub" USE flag is enabled on sys-kernel/installkernel, enabling that flag will also pull in sys-kernel/uefi-mkconfig and install a post-install hook to run that script on each kernel installation. The upcoming v2 of uefi-mkconfig will also be capable of creating backup entries, albeit in a different way then your current script does.
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5093
Location: Bavaria

PostPosted: Sat Jul 13, 2024 11:29 am    Post subject: Reply with quote

AndrewAmmerlaan,

I know that you are the absolute expert for this topic and therefore I would like to discuss the topic: "automation for kernels that are started directly from UEFI".

OP certainly has a faulty BIOS and must therefore copy the kernel as bootx64.efi, which in my opinion must always be done manually (or by individual script), because the routines of installkernel do not cover this.

If you want to start a kernel directly from UEFI, there are two possibilities:
1. you copy the kernel WITHOUT version information as bzImage.efi (or bootx64.efi in the case of a faulty UEFI) and create a UEFI entry pointing to this kernel ONCE, or
2. you copy the kernel WITH version information as bzImage-X-Y-Z.efi and must now create a UEFI entry for each new kernel (and you should also delete old UEFI entries so that this does not become too much in the UEFI BIOS).

The only advantage I see with (2) is that you can see which kernel version is being started. The disadvantage, however, is the constant creation and deletion of UEFI entries. Since I do everything manually myself, I decided to go the first way and have also recommended it here:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI#Cheat_Sheets_for_a_standard_stub_kernel

My question now is: If installkernel goes the first way, who deletes old UEFI entries?
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Sat Jul 13, 2024 11:59 am    Post subject: Reply with quote

pietinger wrote:
I know that you are the absolute expert for this topic and therefore I would like to discuss the topic: "automation for kernels that are started directly from UEFI".

OP certainly has a faulty BIOS and must therefore copy the kernel as bootx64.efi, which in my opinion must always be done manually (or by individual script), because the routines of installkernel do not cover this.


Not sure about this, note that OP's script copies to bootx64.efi at the root of the ESP (not ESP/efi/boot/bootx64.efi, that is backup). So my interpretation here was that UEFI boot entries are (to at least a certain extent) working.

If they are not working properly then OP can still configure the efistub layout and copy to bootx64.efi from there (to avoid having duplicate kernels in /boot).

Quote:
My question now is: If installkernel goes the first way, who deletes old UEFI entries?


app-admin/eclean-kernel and/or uefi-mkconfig. uefi-mkconfig was designed to parallel grub-mkconfig (i.e. it regenerates the config from scratch, old entries are automatically removed), this is the sys-kernel/installkernel[-systemd] route. Effectively entries are removed when the next kernel is installed (as with GRUB).
For sys-kernel/installkernel[+systemd] this is done differently because systemd's kernel-install supports kernel removal as well as installation, and eclean-kernel calls "kernel-install remove" for a given kernel version automatically so in this case removal is handled by the installkernel hook: https://github.com/projg2/installkernel-gentoo/blob/master/hooks/systemd/95-efistub-kernel-bootcfg.install
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5093
Location: Bavaria

PostPosted: Sat Jul 13, 2024 1:00 pm    Post subject: Reply with quote

AndrewAmmerlaan wrote:
app-admin/eclean-kernel and/or uefi-mkconfig. uefi-mkconfig was designed to parallel grub-mkconfig (i.e. it regenerates the config from scratch, old entries are automatically removed), this is the sys-kernel/installkernel[-systemd] route. Effectively entries are removed when the next kernel is installed (as with GRUB). [...]

Thank you very much for this information. So, you have to install (and use) app-admin/eclean-kernel (for a stable system; because uefi-mkconfig is masked with ~amd64) ?
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Sat Jul 13, 2024 1:36 pm    Post subject: Reply with quote

pietinger wrote:
Thank you very much for this information. So, you have to install (and use) app-admin/eclean-kernel (for a stable system; because uefi-mkconfig is masked with ~amd64) ?


The whole of installkernel[efistub] is masked ~arch, the kernel cannot be installed this way without accepting testing keywords to begin with.
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
mega_flow
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2016
Posts: 95
Location: Belgium

PostPosted: Sat Jul 13, 2024 5:28 pm    Post subject: Reply with quote

I don't like to create new UEFI entries ever time a new kernel is install (no fun memory on my first buggy efi computer) . And vfat is to prune on data corruption on bad umount in my experience

I use binpkgs from my server to install and update to different devices, most of it is now automate . Only the kernel install now failed on /boot/EFI
which is very annoying on my steam deck.

But i have a workaround with this problem . i now mount efi drive on /mnt/EFI

thanks for the info on installkernel package
_________________
default/linux/amd64/23.0/no-multilib/gnome/systemd gnome:46
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Thu Jul 25, 2024 12:41 pm    Post subject: Reply with quote

Quote:
If you want to start a kernel directly from UEFI, there are two possibilities:
1. you copy the kernel WITHOUT version information as bzImage.efi (or bootx64.efi in the case of a faulty UEFI) and create a UEFI entry pointing to this kernel ONCE, or
2. you copy the kernel WITH version information as bzImage-X-Y-Z.efi and must now create a UEFI entry for each new kernel (and you should also delete old UEFI entries so that this does not become too much in the UEFI BIOS).


Following up on this. In version 40, sys-kernel/instalkernel can optionally keep a version-less symlink/file up to date for all layouts. Effectively this makes it now possible to use both path 1 (static efistub booting) and path 2 (dynamic efistub booting).
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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