Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922225 - sys-kernel/installkernel-15-r1: make install fails: permission denied
Summary: sys-kernel/installkernel-15-r1: make install fails: permission denied
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Distribution Kernel Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-16 14:25 UTC by Anton Gubarkov
Modified: 2024-02-11 09:50 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/usr/lib/kernel/install.conf (install.conf,107 bytes, text/plain)
2024-01-16 17:47 UTC, Anton Gubarkov
Details
50-dracut.intsall (50-dracut.install,1.42 KB, application/x-shellscript)
2024-01-16 17:49 UTC, Anton Gubarkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Gubarkov 2024-01-16 14:25:07 UTC
PF16W6Y2 /usr/src/linux # make install
  INSTALL /boot
Loading /usr/lib/kernel/install.conf…
layout=bls set via /usr/lib/kernel/install.conf
INITRD_GENERATOR (dracut) set via /usr/lib/kernel/install.conf.
UKI_GENERATOR (dracut) set via /usr/lib/kernel/install.conf.
Loaded /usr/lib/kernel/install.conf.
MACHINE_ID=2c7f8e45cda78c341d153c0f5bc203b4 set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/unified, unified hierarchy for systemd controller
Found container virtualization none.
/run/systemd/inaccessible/blk: Failed to create blkid probe: Permission denied
make[1]: *** [arch/x86/Makefile:292: install] Error 1
make: *** [Makefile:234: __sub-make] Error 2
Comment 1 Anton Gubarkov 2024-01-16 14:27:20 UTC
all operations are performed as root - I'm highly puzzled by "permission denied".


It all started after I had to enable kernel-install USE for systemd as a requirement for some package...
Comment 2 Andrew Nowa Ammerlaan gentoo-dev 2024-01-16 14:56:13 UTC
Is this a systemd or openrc system? Could you show me your USE configuration of sys-kernel/installkernel as well as the contents of /usr/lib/kernel/install.conf, /etc/kernel/install.conf and a list of installed plugins in /usr/lib/kernel/install.d, /etc/kernel/install.d, /etc/kernel/preinst.d and /etc/kernel/postinst.d (in so far as these files and directories exist).

Permission denied is very puzzling indeed. As a workaround you can set SYSTEMD_KERNEL_INSTALL=0 in environment or disable the systemd USE flag on sys-kernel/installkernel to fallback to the 'traditional' installkernel instead of systemd's version.
Comment 3 Andrew Nowa Ammerlaan gentoo-dev 2024-01-16 15:07:21 UTC
Is this system also using btrfs RAID as in [1], if so it should be resolved by [2] which I think is present in systemd 255.2. If [1] describes your setup, could you try upgrading to the latest systemd(-utils) and retry?


[1] https://bugzilla.redhat.com/show_bug.cgi?id=2251262
[2] https://github.com/systemd/systemd/pull/30321
Comment 4 Anton Gubarkov 2024-01-16 17:45:40 UTC
PF16W6Y2 /usr/src/linux # equery u installkernel
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for sys-kernel/installkernel-15-r1:
 U I
 + + dracut  : Generate an initrd or UKI on each kernel installation
 - - grub    : Re-generate grub.cfg on each kernel installation
 + + systemd : Use systemd's kernel-install to install kernels'
 - - uki     : Install UKIs to ESP/EFI/Linux for EFI stub booting and/or bootloaders with support for
               auto-discovering UKIs
 - - ukify   : Build an UKI with systemd's ukify on each kernel installation
Comment 5 Anton Gubarkov 2024-01-16 17:47:13 UTC
Created attachment 882434 [details]
/usr/lib/kernel/install.conf
Comment 6 Anton Gubarkov 2024-01-16 17:48:44 UTC
PF16W6Y2 /usr/src/linux # tree /etc/kernel/
/etc/kernel/
├── install.d
├── postinst.d
└── preinst.d
    └── 50-dracut.install
Comment 7 Anton Gubarkov 2024-01-16 17:49:19 UTC
Created attachment 882435 [details]
50-dracut.intsall
Comment 8 Anton Gubarkov 2024-01-16 17:50:12 UTC
This is a systemd system, and I didn't customize anything regarding installkernel package.
Comment 9 Anton Gubarkov 2024-01-16 17:52:29 UTC
PF16W6Y2 /usr/src/linux # tree /usr/lib/kernel/
/usr/lib/kernel/
├── install.conf
└── install.d
    ├── 00-00machineid-directory.install
    ├── 10-copy-prebuilt.install
    ├── 50-depmod.install
    ├── 50-dracut.install
    ├── 51-dracut-rescue.install
    ├── 90-loaderentry.install
    ├── 90-uki-copy.install
    └── 91-grub-mkconfig.install

I didn't change any of these files.
Comment 10 Anton Gubarkov 2024-01-16 17:57:08 UTC
(In reply to Andrew Ammerlaan from comment #3)
> Is this system also using btrfs RAID as in [1], if so it should be resolved
> by [2] which I think is present in systemd 255.2. If [1] describes your
> setup, could you try upgrading to the latest systemd(-utils) and retry?
> 
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=2251262
> [2] https://github.com/systemd/systemd/pull/30321

This system indeed uses a btrfs mirror for /boot.
Comment 11 Anton Gubarkov 2024-01-16 18:17:12 UTC
I'm on systemd 255.2-r2 and I still experience this issue.
Setting SYSTEMD_KERNEL_INSTALL=0 allows me to install the kernel.

The automated generation of the initramfs during the kernel install is pre-mature for me as I use the out-of-tree kernel modules (zfs) and they are not usually rebuilt for the new kernel version by that moment.

How can I disable it?
Comment 12 Andrew Nowa Ammerlaan gentoo-dev 2024-01-16 18:39:03 UTC
(In reply to Anton Gubarkov from comment #11)
> I'm on systemd 255.2-r2 and I still experience this issue.
> Setting SYSTEMD_KERNEL_INSTALL=0 allows me to install the kernel.

Could you try manually applying the patch from [2] to confirm that it is indeed the same issue and that it will be fixed in the next release.

> The automated generation of the initramfs during the kernel install is
> pre-mature for me as I use the out-of-tree kernel modules (zfs) and they are
> not usually rebuilt for the new kernel version by that moment.
> 
> How can I disable it?

Set USE=-dracut on sys-kernel/installkernel. Unfortunately the traditional installkernel (USE=-systemd) is not configurable so you either have to remove the plugin /etc/kernel/preinst.d/50-dracut.install or disable its installation with USE=-dracut. 

The "new" systemd version is configurable though and with this installation method you can disable the dracut plugin by setting initrd_generator to something other then dracut.

Another thing you could consider, instead of disabling the dracut plugin is to create a custom plugin (i.e. 40-zfs.install) that installs the zfs kernel module for the new kernel version before the dracut plugin (50-dracut.install) is run. (perhaps this is something we could even ship with the zfs package, but this is something for the zfs maintainers to look into).

See also the new installkernel wiki page [3].

CC'ing @systemd since the problem originates there. Maybe we can backport the patch from [2], or perhaps we can simply wait for the next release.

[2] https://github.com/systemd/systemd/pull/30321
[3] https://wiki.gentoo.org/wiki/Installkernel
Comment 13 Andrew Nowa Ammerlaan gentoo-dev 2024-01-17 20:45:39 UTC
(In reply to Andrew Ammerlaan from comment #12)
> Another thing you could consider, instead of disabling the dracut plugin is
> to create a custom plugin (i.e. 40-zfs.install) that installs the zfs kernel
> module for the new kernel version before the dracut plugin
> (50-dracut.install) is run. (perhaps this is something we could even ship
> with the zfs package, but this is something for the zfs maintainers to look
> into).

I added instructions explaining how to do this, with an example, to the wiki page [3].

[3] https://wiki.gentoo.org/wiki/Installkernel
Comment 14 Anton Gubarkov 2024-01-18 09:29:32 UTC
(In reply to Andrew Ammerlaan from comment #12)
> (In reply to Anton Gubarkov from comment #11)
> > I'm on systemd 255.2-r2 and I still experience this issue.
> > Setting SYSTEMD_KERNEL_INSTALL=0 allows me to install the kernel.
> 
> Could you try manually applying the patch from [2] to confirm that it is
> indeed the same issue and that it will be fixed in the next release.
> 
> > The automated generation of the initramfs during the kernel install is
> > pre-mature for me as I use the out-of-tree kernel modules (zfs) and they are
> > not usually rebuilt for the new kernel version by that moment.
> > 
> > How can I disable it?
> 
> Set USE=-dracut on sys-kernel/installkernel. Unfortunately the traditional
> installkernel (USE=-systemd) is not configurable so you either have to
> remove the plugin /etc/kernel/preinst.d/50-dracut.install or disable its
> installation with USE=-dracut. 
> 
> The "new" systemd version is configurable though and with this installation
> method you can disable the dracut plugin by setting initrd_generator to
> something other then dracut.
> 
> Another thing you could consider, instead of disabling the dracut plugin is
> to create a custom plugin (i.e. 40-zfs.install) that installs the zfs kernel
> module for the new kernel version before the dracut plugin
> (50-dracut.install) is run. (perhaps this is something we could even ship
> with the zfs package, but this is something for the zfs maintainers to look
> into).
> 
> See also the new installkernel wiki page [3].
> 
> CC'ing @systemd since the problem originates there. Maybe we can backport
> the patch from [2], or perhaps we can simply wait for the next release.
> 
> [2] https://github.com/systemd/systemd/pull/30321
> [3] https://wiki.gentoo.org/wiki/Installkernel

I applied the [2] to my systemd and I was able to run make install. 


PF16W6Y2 /usr/src/linux # make install
  INSTALL /boot
Loading /usr/lib/kernel/install.conf…
layout=bls set via /usr/lib/kernel/install.conf
INITRD_GENERATOR (dracut) set via /usr/lib/kernel/install.conf.
UKI_GENERATOR (dracut) set via /usr/lib/kernel/install.conf.
Loaded /usr/lib/kernel/install.conf.
MACHINE_ID=2c7f8e45cda78c341d153c0f5bc203b4 set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/unified, unified hierarchy for systemd controller
Found container virtualization none.
Could not determine backing block device of directory "/boot" (btrfs RAID?).
Couldn't find an XBOOTLDR partition.
Failed to check file system type of "/efi": No such file or directory
File system "/boot" is not a FAT EFI System Partition (ESP) file system.
Using EFI System Partition at /boot/efi as $BOOT_ROOT.
Using entry token: 2c7f8e45cda78c341d153c0f5bc203b4
kernel version (6.6.12-gentoo) set via command line.
kernel image file (/usr/src/linux/arch/x86/boot/bzImage) set via command line.
File lacks MZ executable header.
Using ENTRY_DIR=/boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo
mkdir -p /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo
Using plugins: 
  /usr/lib/kernel/install.d/00-00machineid-directory.install
  /usr/lib/kernel/install.d/10-copy-prebuilt.install
  /usr/lib/kernel/install.d/50-depmod.install
  /usr/lib/kernel/install.d/50-dracut.install
  /usr/lib/kernel/install.d/51-dracut-rescue.install
  /usr/lib/kernel/install.d/90-loaderentry.install
  /usr/lib/kernel/install.d/90-uki-copy.install
  /usr/lib/kernel/install.d/91-grub-mkconfig.install
Plugin environment: 
  LC_COLLATE=C.UTF-8
  KERNEL_INSTALL_VERBOSE=1
  KERNEL_INSTALL_IMAGE_TYPE=unknown
  KERNEL_INSTALL_MACHINE_ID=2c7f8e45cda78c341d153c0f5bc203b4
  KERNEL_INSTALL_ENTRY_TOKEN=2c7f8e45cda78c341d153c0f5bc203b4
  KERNEL_INSTALL_BOOT_ROOT=/boot/efi
  KERNEL_INSTALL_LAYOUT=bls
  KERNEL_INSTALL_INITRD_GENERATOR=dracut
  KERNEL_INSTALL_UKI_GENERATOR=dracut
  KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.HEXEIR
Plugin arguments: add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(sd-exec-strv)' as PID 563619.
About to execute /usr/lib/kernel/install.d/00-00machineid-directory.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563620.
/usr/lib/kernel/install.d/00-00machineid-directory.install succeeded.
About to execute /usr/lib/kernel/install.d/10-copy-prebuilt.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563621.
Copying prebuilt initramfs to staging area
/usr/lib/kernel/install.d/10-copy-prebuilt.install succeeded.
About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563624.
+depmod -a 6.6.12-gentoo
/usr/lib/kernel/install.d/50-depmod.install succeeded.
About to execute /usr/lib/kernel/install.d/50-dracut.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563625.
There is an initrd image at the same place as the kernel, skipping generating a new one
/usr/lib/kernel/install.d/50-dracut.install succeeded.
About to execute /usr/lib/kernel/install.d/51-dracut-rescue.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563631.
Skipping, 'dracut_rescue_image' not set to 'yes' in any dracut configuration file
/usr/lib/kernel/install.d/51-dracut-rescue.install succeeded.
About to execute /usr/lib/kernel/install.d/90-loaderentry.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563636.
Installing /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo/initrd
Creating /boot/efi/loader/entries/2c7f8e45cda78c341d153c0f5bc203b4-6.6.12-gentoo.conf
/usr/lib/kernel/install.d/90-loaderentry.install succeeded.
About to execute /usr/lib/kernel/install.d/90-uki-copy.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563649.
/usr/lib/kernel/install.d/90-uki-copy.install succeeded.
About to execute /usr/lib/kernel/install.d/91-grub-mkconfig.install add 6.6.12-gentoo /boot/efi/2c7f8e45cda78c341d153c0f5bc203b4/6.6.12-gentoo /usr/src/linux/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 563650.
Generating new GRUB config as /boot/efi/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
/usr/lib/kernel/install.d/91-grub-mkconfig.install succeeded.
(sd-exec-strv) succeeded.
Comment 15 Andrew Nowa Ammerlaan gentoo-dev 2024-01-18 10:35:54 UTC
(In reply to Anton Gubarkov from comment #14)
> I applied the [2] to my systemd and I was able to run make install. 

Great! Thanks for checking!
Comment 16 Andrew Nowa Ammerlaan gentoo-dev 2024-01-25 11:13:27 UTC
This should now be resolved in sys-apps/systemd-255.3. Please re-open if this is not the case.
Comment 17 Anton Gubarkov 2024-02-11 09:47:29 UTC
(In reply to Andrew Ammerlaan from comment #13)
> (In reply to Andrew Ammerlaan from comment #12)
> > Another thing you could consider, instead of disabling the dracut plugin is
> > to create a custom plugin (i.e. 40-zfs.install) that installs the zfs kernel
> > module for the new kernel version before the dracut plugin
> > (50-dracut.install) is run. (perhaps this is something we could even ship
> > with the zfs package, but this is something for the zfs maintainers to look
> > into).
> 
> I added instructions explaining how to do this, with an example, to the wiki
> page [3].
> 
> [3] https://wiki.gentoo.org/wiki/Installkernel

The instructions to run emerge @module-rebuild are gone :-(. together with the use flag module-rebuild for installkernel.

Can you please post them back?
Comment 18 Andrew Nowa Ammerlaan gentoo-dev 2024-02-11 09:50:42 UTC
(In reply to Anton Gubarkov from comment #17)
> (In reply to Andrew Ammerlaan from comment #13)
> > (In reply to Andrew Ammerlaan from comment #12)
> > > Another thing you could consider, instead of disabling the dracut plugin is
> > > to create a custom plugin (i.e. 40-zfs.install) that installs the zfs kernel
> > > module for the new kernel version before the dracut plugin
> > > (50-dracut.install) is run. (perhaps this is something we could even ship
> > > with the zfs package, but this is something for the zfs maintainers to look
> > > into).
> > 
> > I added instructions explaining how to do this, with an example, to the wiki
> > page [3].
> > 
> > [3] https://wiki.gentoo.org/wiki/Installkernel
> 
> The instructions to run emerge @module-rebuild are gone :-(. together with
> the use flag module-rebuild for installkernel.
> 
> Can you please post them back?

See Bug 923025

We unfortunately had to remove this feature because it was a bit messy and caused problems on systems that did not have parallel-install enabled.