sys-kernel/installkernel-16 with "USE=-* dracut module-rebuild" I have "CONFIG_LOCALVERSION=-local" set in the kernel config. After compiling the kernel, installkernel triggers a module-rebuild (zfs-kmod in my case), but it immediately fails because: * Determining the location of the kernel source code * Unable to find kernel sources at /usr/src/linux-6.6.12-gentoo-local * Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against. /usr/src/linux-6.6.12-gentoo-local indeed doesn't exist, but /usr/src/linux-6.6.12-gentoo does, and /usr/src/linux is a symlink to it. If I do a "emerge @module-rebuild" myself, it compiles correctly. Reproducible: Always Steps to Reproduce: 1. Compile a kernel with CONFIG_LOCALVERSION set 2. make modules_install install 3. ... profit!
If I understand correctly, the problem is not that the plugin ignores the LOCALVERSION, but rather that the KERNEL_VERSION that we use to set KERNEL_DIR contains the LOCALVERSION when it should not. Correct? The direct emerge @module-rebuild would still work as expected indeed because if unset KERNEL_DIR defaults to /usr/src/linux. But in the plugin we want to install the modules for the kernel version that we are installing, which may or may not be the same as the kernel version selected by eselect kernel.
Right, sorry, the title is a bit misleading. You're correct, The KERNEL_VERSION you use to set the KERNEL_DIR includes the LOCALVERSION when it shouldn't.
Hmm, after digging a bit into this, the problem is not necessarily that we do or do not take into account the LOCALVERSION. The problem is that KERNEL_VERSION does not necessarily match the name of the directory containing the kernel sources in /usr/src/. I have a fix in mind that I will release soon, just need to finish testing.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=536a22a56713c5384b22f9056aff676638a9040d commit 536a22a56713c5384b22f9056aff676638a9040d Author: Andrew Ammerlaan <andrewammerlaan@gentoo.org> AuthorDate: 2024-01-19 10:56:43 +0000 Commit: Andrew Ammerlaan <andrewammerlaan@gentoo.org> CommitDate: 2024-01-19 10:57:10 +0000 sys-kernel/installkernel: add 17 Closes: https://bugs.gentoo.org/922446 Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org> sys-kernel/installkernel/Manifest | 1 + sys-kernel/installkernel/installkernel-17.ebuild | 114 +++++++++++++++++++++++ 2 files changed, 115 insertions(+)
Version 17 should fix your problem, this version is a bit smarter about finding the correct KERNEL_DIR and it will fail earlier if it can't be found. Please let me know if it works on your end now, and please reopen the bug if it does not.
Yes, version 17 works as expected now! Thanks for the quick fix!