Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't Install EFI Stub Kernel
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
ejb
n00b
n00b


Joined: 25 Jul 2024
Posts: 6

PostPosted: Thu Aug 08, 2024 5:26 pm    Post subject: Can't Install EFI Stub Kernel Reply with quote

Hello,

I have a few days of free time in which to get this system up and running (I need it for some development work because a Linux system is needed (I am writing some stuff that will run on a Raspberry Pi that relies on external hardware, so having it appear in the same /dev/whatever format is useful). I have not had success in getting the kernel to install. I am trying to use an EFI stub kernel, as the title suggests.

I am using a distribution kernel.

I am not sure if the problem is a circular dependency between the firmware and the kernel, or if it is because when I first installed the firmware (it complained about the kernel being missing but installed the packages anyway (the linux-firmware and intel-microcode packages)) I had the uki flag on for installkernel. I no longer have that flag as I realised it would probably cause me a lot of bother for little gain since I don't really care about secureboot. (Should I though?)

Anyway, now both the firmware and the kernel fail to install.

This is the error from an attempt to configure the kernel because the firmware error told me to emerge --config it:

Code:

 * 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.41:6.6.41'
 * ERROR: sys-kernel/gentoo-kernel-6.6.41::gentoo failed (config phase):
 *   Kernel install failed, please fix the problems and run emerge --config
 *
 * Call stack:
 *     ebuild.sh, line  136:  Called pkg_config
 *   environment, line 2685:  Called kernel-install_pkg_config
 *   environment, line 2177:  Called kernel-install_install_all '6.6.41-gentoo-dist'
 *   environment, line 2169:  Called dist-kernel_install_kernel '6.6.41-gentoo-dist' '/usr/src/linux-6.6.41-gentoo-dist/arch/x86/boot/bzImage' '/usr/src/linux-6.6.41-gentoo-dist/System.map'
 *   environment, line 1051:  Called die
 * The specific snippet of code:
 *           die "Kernel install failed, please fix the problems and run emerge --config";
 *
 * If you need support, post the output of `emerge --info '=sys-kernel/gentoo-kernel-6.6.41::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/gentoo-kernel-6.6.41::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.41/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.41/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.41/empty'
 * S: '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.41/work/gentoo-kernel-6.6.41'


And this is the output of the emerge --info "=sys-kernel/gentoo-kernel-6.6.41::gentoo" command:
https://gist.github.com/ejb-11/06036caf1e2c66afabf2ee6c3cf9ca59

Also, the handbook and the wiki instructions for EFI stub installs are not very clear, and are scattered between two different parts: "Configuring the kernel" and the three chapters later "Configuring the bootloader". This confusing layout, along with omitted information about configuring dracut (and other missing info) have really made this a lot harder than it needs to be.

Any help is appreciated.

UPDATE: Tried forcefully removing the firmware and microcode and the old kernel and using gentoo-kernel-bin. No joy. Looked in /efi/EFI/Gentoo and found that there was indeed the expected "whatever the name was".efi and .img files, so something had at least tried to get it working. Removing those has not helped.

What's really annoying is that emerge -a gentoo-kernel-bin gives a warning when no firmware is installed, but the firmware cannot be installed correctly without a kernel already present. This seems to be contradictory behaviour and is very hostile to new users (as I can't tell what's a genuine problem and what's just portage having a hissy fit).


EDIT: Should this be in the kernel section? Also it might have something to do with the kernel-bootcfg-boot-successful not running inside chroot environments, I don't know.


Last edited by ejb on Thu Aug 08, 2024 8:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
ejb
n00b
n00b


Joined: 25 Jul 2024
Posts: 6

PostPosted: Thu Aug 08, 2024 7:18 pm    Post subject: Reply with quote

Just to clarify, I am doing this from the Gentoo LiveUSB installation medium. Maybe EFIstub installation and configuration was only tested on established installs that have already had a GRUB kernel installed?
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 3038

PostPosted: Fri Aug 09, 2024 3:22 am    Post subject: Re: Can't Install EFI Stub Kernel Reply with quote

ejb wrote:
when I first installed the firmware (it complained about the kernel being missing


First rule of reporting issues here, do not paraphrase in your own words.
List out exact commands done and exact command output.
Give us all the info that Portage asked you to give when it errors.
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Fri Aug 09, 2024 5:50 am    Post subject: Reply with quote

That log is not complete, please show us the full log from linux-firmware.

The very short version of the instructions to use efistub booting is to enable the "efistub" USE flag and then re-install the kernel with emerge --config gentoo-kernel. There are instructions in the handbook for running stuff like dracut manually, you do not have to do any of that if you use installkernel.

But the post install output of linux-firmware indicates there is a problem installing the kernel, so lets fix that first.

Quote:
Also it might have something to do with the kernel-bootcfg-boot-successful not running inside chroot environments,


That service runs at boot, once, it will never do anything in a chroot, but that is fine because it is not supposed to do anything in a chroot.
_________________
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
ejb
n00b
n00b


Joined: 25 Jul 2024
Posts: 6

PostPosted: Fri Aug 09, 2024 8:48 pm    Post subject: Reply with quote

It has changed behaviour (I started again from the start after formatting to see if that would fix it; no dice). The log is too big to be catted into the terminal, and it is weird-looking in nano (first line is: ^[[32m * ^[[39;49;00mPackage: sys-kernel/gentoo-kernel-6.6.41:6.6.41) How should I upload this huge file (to gist), and cleanse it of all this weird junk?

But now instead the kernel is being pulled as a dependency for the firmware, despite the kernel trying to install with the firmware (which has not yet been installed at that point in the list of tasks for emerge), thus causing an error. I think this is what is happening, anyway. Very annoying.

I don't have time to mess about with broken distros with circular dependencies and conflicting documentation, and I really don't have time to debug this so I am going to give up and go try something less convoluted like Artix or CachyOS.

PS: During writing this, I have realised that the build log appears to have deleted itself after I uninstalled the broken kernel package, so I can't help, though I would have been willing. Sorry about that. I thought build logs (being in /var/tmp/portage/ and all that) would stay even if the package were removed.

Thanks anyway for the help you might have offered!
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 3038

PostPosted: Sat Aug 10, 2024 1:29 am    Post subject: Reply with quote

ejb wrote:
It has changed behaviour (I started again from the start after formatting to see if that would fix it; no dice). The log is too big to be catted into the terminal, and it is weird-looking in nano (first line is: ^[[32m * ^[[39;49;00mPackage: sys-kernel/gentoo-kernel-6.6.41:6.6.41) How should I upload this huge file (to gist), and cleanse it of all this weird junk?


https://wiki.gentoo.org/wiki/Wgetpaste and see ansifilter section of the link for the cleaning.
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Sat Aug 10, 2024 8:08 am    Post subject: Reply with quote

ejb wrote:
But now instead the kernel is being pulled as a dependency for the firmware, despite the kernel trying to install with the firmware (which has not yet been installed at that point in the list of tasks for emerge), thus causing an error. I think this is what is happening, anyway. Very annoying.


You misunderstand, the firmware does not really depend on the kernel, nor does the kernel depend on the firmware. The gentoo-kernel(-bin) will try to install itself via sys-kernel/installkernel, the firmware does not have to be present on the system to do this. Then sys-kernel/linux-firmware tries to re-install the same kernel, it is pretty standard behaviour for the package providing cpu microcode to trigger re-installation of the initramfs. Obviously if the initial installation via gentoo-kernel(-bin) fails then the re-installation via linux-firmware will fail as well.

Your problem is not in gentoo-kernel(-bin) nor is it in linux-firmware. The problem is that one of the kernel installation hooks run via sys-kernel/installkernel fails, likely the one responsible for setting up direct efi stub booting.

Quote:
I don't have time to mess about with broken distros with circular dependencies and conflicting documentation, and I really don't have time to debug this so I am going to give up and go try something less convoluted like Artix or CachyOS.


Come one, that is unfair. The direct efistub booting is marked explicitly as highly experimental, in the handbook, in the post install messages of sys-kernel/installkernel, and by the fact that the use flag is stable masked. Yet, despite this you tried it anyway. That's fine, but then don't go claiming the distro is broken, you decided to try something that we explicitly mark as experimental. If you want the "it just works" experience, choose systemd-boot, or grub instead of direct efi stub booting.

I maintain sys-kernel/installkernel and app-emulation/virt-firmware and I can help you resolve this pretty quickly, I don't need you to debug anything, I just need the full kernel installation log. The usual reasons kernel-bootcfg exits fatally are:
- it has detected that secureboot is enabled, but the signing key of the kernel is not in the key DB, so shim is required, but kernel-bootcfg did not find sys-boot/shim.
- the kernel-bootcfg-boot-successful systemd service is not enabled

Now since this feature is experimental, it may well be that there is some bug, or that there are some steps missing in the handbook. If that is the case, then I would love to fix that problem. So please run:
Code:
wgetpaste -c 'emerge --config gentoo-kernel --ask=n'


And share with us the resulting url. Replacing gentoo-kernel with gentoo-kernel-bin if you use the prebuilt kernel instead.
_________________
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
sager58
n00b
n00b


Joined: 03 Jan 2005
Posts: 14
Location: Cornwall, NY

PostPosted: Fri Sep 13, 2024 7:17 pm    Post subject: Reply with quote

AndrewAmmerlaan wrote:

I maintain sys-kernel/installkernel and app-emulation/virt-firmware and I can help you resolve this pretty quickly, I don't need you to debug anything, I just need the full kernel installation log. The usual reasons kernel-bootcfg exits fatally are:
- it has detected that secureboot is enabled, but the signing key of the kernel is not in the key DB, so shim is required, but kernel-bootcfg did not find sys-boot/shim.
- the kernel-bootcfg-boot-successful systemd service is not enabled


Thank you. I was experiencing this issue on a freshly built system with systemd, and you provided the answer I was looking for.
_________________
Turn Left...
Back to top
View user's profile Send private message
azumi2000
n00b
n00b


Joined: 27 Sep 2024
Posts: 1
Location: Brisbane, Australia

PostPosted: Fri Sep 27, 2024 2:48 am    Post subject: Reply with quote

sager58 wrote:
AndrewAmmerlaan wrote:

I maintain sys-kernel/installkernel and app-emulation/virt-firmware and I can help you resolve this pretty quickly, I don't need you to debug anything, I just need the full kernel installation log. The usual reasons kernel-bootcfg exits fatally are:
- it has detected that secureboot is enabled, but the signing key of the kernel is not in the key DB, so shim is required, but kernel-bootcfg did not find sys-boot/shim.
- the kernel-bootcfg-boot-successful systemd service is not enabled


Thank you. I was experiencing this issue on a freshly built system with systemd, and you provided the answer I was looking for.


Hi, I'm also having this issue - did you end up solving it?
I've tried
Code:
 systemctl enable kernel-bootcfg-boot-successful
but that didn't fix it.

This is my emerge info: https://bpa.st/LJPRI
This is the build log: https://bpa.st/3W6TI (the entire log was too large to upload)
I don't have secure boot enabled.

[UPDATE: maybe solved]
Since I can't enable systemd services in the bootable live environment, I believe I have to use a different bootloader first, then install the EFI stub. I've now installed grub and can't be bothered to change it :)
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 429
Location: Nijmegen

PostPosted: Fri Sep 27, 2024 7:47 am    Post subject: Reply with quote

That is definitely a bug, could you please report this upstream at https://gitlab.com/kraxel/virt-firmware ?

It looks like it is not able to find the PARTUUID of the ESP in a chroot, I've seen such an issue before elsewhere and this was caused by /run not being bind mounted into the chroot. This could be the same problem, but regardless the code should handle this case better and print a more helpful error message.
_________________
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 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