Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 937569

Summary: dist-kernel-utils.eclass: dist-kernel_compressed_module_cleanup looks for .config in wrong directory, resulting in "Cannot find kernel config ..." error
Product: Gentoo Linux Reporter: Florian Albrechtskirchinger <falbrechtskirchinger>
Component: EclassesAssignee: Distribution Kernel Project <dist-kernel>
Status: RESOLVED FIXED    
Severity: normal CC: andrewammerlaan, falbrechtskirchinger, holger, ionen
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/gentoo/gentoo/pull/38016
See Also: https://github.com/gentoo/gentoo/pull/38016
Whiteboard:
Package list:
Runtime testing required: ---

Description Florian Albrechtskirchinger 2024-08-08 11:23:04 UTC
A recent change [1] to dist-kernel_compressed_module_cleanup() in dist-kernel-utils.eclass looks for the kernel config in /lib/modules/${KV_FULL}/source/.
To the best of my knowledge, this directory does not exist and the author probably meant /lib/modules/${KV_FULL}/build/ instead. Indeed, making this edit locally fixes the following error:

 * FAILED postinst: 1
 * ERROR: x11-drivers/nvidia-drivers-560.31.02::gentoo failed (postinst phase):
 *   Cannot find kernel config /lib/modules/6.10.3-gentoo-x86_64/source/.config

[1]: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=facd2865e403fd295c955fff8d609bfc717aed24
Comment 1 Nowa Ammerlaan gentoo-dev 2024-08-08 11:30:57 UTC
> To the best of my knowledge, this directory does not exist

It does on my system, and AFAIK it should always exist.

How do you build/install your kernel?
Comment 2 Florian Albrechtskirchinger 2024-08-08 11:40:49 UTC
(In reply to Andrew Nowa Ammerlaan from comment #1)
> > To the best of my knowledge, this directory does not exist
> 
> It does on my system, and AFAIK it should always exist.
> 
> How do you build/install your kernel?

Basically:

make
make modules_install
emerge @module-rebuild
make install

And that (modules_install, specifically, I'd imagine) results in a build/ symlink to the kernel source.

I've never seen a source/ directory, where's that supposed to come from?
Comment 3 Nowa Ammerlaan gentoo-dev 2024-08-08 11:41:35 UTC
> where's that supposed to come from?

From modules-install I think
Comment 4 Florian Albrechtskirchinger 2024-08-08 11:49:45 UTC
This seems relevant:
https://lwn.net/Articles/90689/

There's a mixed-build variable in the Makefile which pointed me that way. I'll keep reading and report back.
Comment 5 Florian Albrechtskirchinger 2024-08-08 12:00:53 UTC
Building from inside /usr/src/linux skips the creation of the source symlink.
Symlink creation happens in a guarded block: ifdef building_out_of_srctree

I think you need to fall back to build if source doesn't exist.
Comment 6 Nowa Ammerlaan gentoo-dev 2024-08-08 12:07:55 UTC
Please let me know if this[1] resolves your problem.

[1] https://github.com/gentoo/gentoo/pull/38016
Comment 7 Florian Albrechtskirchinger 2024-08-08 12:20:55 UTC
(In reply to Andrew Nowa Ammerlaan from comment #6)
> Please let me know if this[1] resolves your problem.
> 
> [1] https://github.com/gentoo/gentoo/pull/38016

Works like a charm. Thanks!
Comment 8 Ionen Wolkens gentoo-dev 2024-08-08 13:15:07 UTC
fwiw the source is not even guaranteed to exist in postinst, virtual/linux-sources is just a DEPEND, not IDEPEND and it could be a binpkg installing modules on a system without the sources
Comment 9 Ionen Wolkens gentoo-dev 2024-08-08 13:17:48 UTC
(In reply to Ionen Wolkens from comment #8)
> fwiw the source is not even guaranteed to exist in postinst,
> virtual/linux-sources is just a DEPEND, not IDEPEND and it could be a binpkg
> installing modules on a system without the sources
aka, it probably at least shouldn't die with the current method, maybe warn at best

Not that I really looked at these eclass changes or thought about it, haven't had time.
Comment 10 Larry the Git Cow gentoo-dev 2024-08-08 16:46:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c75b6bf3c8b84eb3a674613cf054b54b053bbd7c

commit c75b6bf3c8b84eb3a674613cf054b54b053bbd7c
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-08-08 12:02:35 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-08-08 16:44:27 +0000

    (dist-)kernel-{install,utils}.eclass: fix finding config during cleanup
    
    The source symlink does not exist on all systems.
    
    If we can't find any config at all then there will be no preferred suffix
    which means we fall back to the old '-nt' based cleaning.
    
    Closes: https://bugs.gentoo.org/937569
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/38016
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 eclass/dist-kernel-utils.eclass | 18 +++++++++++++++---
 eclass/kernel-install.eclass    |  2 +-
 2 files changed, 16 insertions(+), 4 deletions(-)