Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922446 - sys-kernel/installkernel-16 module-rebuild ignores CONFIG_LOCALVERSION
Summary: sys-kernel/installkernel-16 module-rebuild ignores CONFIG_LOCALVERSION
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Distribution Kernel Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-18 20:41 UTC by Nopel
Modified: 2024-01-19 12:37 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nopel 2024-01-18 20:41:25 UTC
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!
Comment 1 Nowa Ammerlaan gentoo-dev 2024-01-18 21:42:52 UTC
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.
Comment 2 Nopel 2024-01-18 22:38:10 UTC
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.
Comment 3 Nowa Ammerlaan gentoo-dev 2024-01-19 10:26:31 UTC
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.
Comment 4 Larry the Git Cow gentoo-dev 2024-01-19 10:57:22 UTC
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(+)
Comment 5 Nowa Ammerlaan gentoo-dev 2024-01-19 10:59:09 UTC
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.
Comment 6 Nopel 2024-01-19 12:37:08 UTC
Yes, version 17 works as expected now!

Thanks for the quick fix!