according to the systemd-installkernel manpage, files in /etc/kernel/install.d should override files in /usr/lib/kernel/install.d/ if they have the same name. This makes sense, because otherwise there is no way of preventing a file in /usr/lib/kernel/install.d from running, or from replacing existing functionality. The dist-kernel-utils.eclass function "dist-kernel_install_kernel()" appends the files to KERNEL_INSTALL_PLUGINS when addressing a bug that makes dracut run twice. Reproducible: Always Steps to Reproduce: 1. Have a file with the same name as a file in /usr/lib/kernel/install.d/ in /etc/kernel/install.d/ 2. run emerge --config gentoo-kernel (or another distribution kernel) with installkernel-systemd-boot installed Actual Results: both the file in /usr/lib/kernel/install.d/ and the file in /etc/kernel/install.d/ are executed Expected Results: Only the file in /etc/kernel/install.d is executed
Created attachment 865052 [details, diff] fix-etc-install-scripts.patch
Created attachment 865053 [details, diff] fix-etc-install-scripts.patch missed off a "local" in the original patch
Thanks for the patch. Andrew, can you confirm?
(In reply to Michał Górny from comment #3) > Thanks for the patch. > > Andrew, can you confirm? Yes this does appear to be the intended behaviour, from the manual: kernel-install will run the executable files ("plugins") located in the directory /usr/lib/kernel/install.d/ and the local administration directory /etc/kernel/install.d/. All files are collectively sorted and executed in lexical order, regardless of the directory in which they live. However, files with identical filenames replace each other. Files in /etc/kernel/install.d/ take precedence over files with the same name in /usr/lib/kernel/install.d/. This can be used to override a system-supplied executables with a local file if needed; a symbolic link in /etc/kernel/install.d/ with the same name as an executable in /usr/lib/kernel/install.d/, pointing to /dev/null, disables the executable entirely. Executables must have the extension ".install"; other extensions are ignored.
Btw, my upstream PR with the proper fix has been merged, so hopefully we can get rid of this workaround soon.
Chris, could you either reattach the patch in git format with a proper signed-off-by line, or at least paste the signed-off-by line in a comment to confirm that the commit agrees with the DCO?
Will do, but it will likely be tomorrow now as I'm busy for the rest of the day!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f54de2508fd57a8f31b5dc61b970448ab22c20d commit 7f54de2508fd57a8f31b5dc61b970448ab22c20d Author: Chris Pritchard <chris@christopherpritchard.co.uk> AuthorDate: 2023-07-04 23:01:24 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2023-07-05 06:19:04 +0000 dist-kernel-utils.eclass: fix user script overrides Closes: https://bugs.gentoo.org/909538 Signed-off-by: Chris Pritchard <chris@christopherpritchard.co.uk> Closes: https://github.com/gentoo/gentoo/pull/31745 Signed-off-by: Michał Górny <mgorny@gentoo.org> eclass/dist-kernel-utils.eclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)