While installing virtualbox (and virtualbox-modules, which is the actual ebuild that pokes this problem), I noticed this: >>> Install app-emulation/virtualbox-modules-7.0.6 into /var/tmp/portage/app-emulation/virtualbox-modules-7.0.6/image * Installing vboxdrv module modinfo: ERROR: Module /var/tmp/portage/app-emulation/virtualbox-modules-7.0.6/work/vboxdrv.ko not found. * Preparing file for modprobe.d ... [ ok ] * Installing vboxnetflt module * Installing vboxnetadp module The ebuild, however, succeeds and installs. I don't use virtualbox very often (and I don't even load the modules normally), so it's not clear to me that this actual prevents virtualbox's modules from loading. In any event, after poking around the logfiles and the eclass, I suspect the issue is that linux-mod.eclass isn't handling compressed modules quite correctly: The linux-mod_src_install() function in the eclass is aware of CONFIG_MODULES_COMPRESS (see https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/linux-mod.eclass?id=bcecd378c02f0950356d7bf924d54d87a03baa54#n681 up to line ~700), and will use that kernel config option to compress the ebuild's modules. It then calls generate_modulesd() with the modulename as an argument. Looking at generate_modulesd(), it does some poking at the module before attempting to create a modules.d entry; one of the things it runs is "modinfo -p ${currm_path}.${KV_OBJ}" (see https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/linux-mod.eclass?id=bcecd378c02f0950356d7bf924d54d87a03baa54#n388), and I believe this is where the error message in the above log is coming from. (Note that the notice about "Preparing file for modprobe.d" occurs right after this error in the log file.) Now, given that it's running modinfo on ${currm_path}.${KV_OBJ}, and given that the compression functions in linux-mod_src_install() use ${modulename}.${KV_OBJ} as _input_ into the compression tool (which will spit the module out with an extension indicating the compression format), I believe these two functions are mismatched in how they're looking for modules. Now, this is by inspection; I didn't do a bunch of printf debugging (though, I suppose I could?) The solution should be reasonably simple, insomuch as that CONFIG_MODULES_COMPRESS_xxx logic needs to be available to any function that later manipulates modules, so it looks for the right name. (Probably refactoring this logic out would be the easiest...) Reproducible: Always Steps to Reproduce: 1. Configure and build a kernel with CONFIG_MODULES_COMPRESS_xxx and choose a compression format. 2. Emerge virtualbox-modules (or, potentially any ebuild that uses this eclass logic) 3. Observe failure! (hopefully?)
Created attachment 861643 [details] /var/log/portage/app-emulation:virtualbox-modules-7.0.6:20230511-233147.log Full log for a virtualbox-modules-7.0.6 build. One item of note: the error message is in the last ~20 lines of the log; around here, you'll see: * Running /root/src/systools/sign-kmods.sh /var/tmp/portage/app-emulation/virtualbox-modules-7.0.6/work vbox*.ko This comes from some custom module writing stuff I wrote and put in /etc/portage/bashrc; _however_ I have previous build logs before I added the module signing stuff which display the same exact error, and I can remove the signing functions, and easily reproduce the error.
Thanks for the report and the analysis. I am taking a look.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f6898bdcc89290841e081b62987c764f97a506b commit 9f6898bdcc89290841e081b62987c764f97a506b Author: Mike Pagano <mpagano@gentoo.org> AuthorDate: 2023-05-17 22:25:22 +0000 Commit: Mike Pagano <mpagano@gentoo.org> CommitDate: 2023-05-17 22:25:22 +0000 linux-mod.eclass: Store compression ext in variable When the kernel configuration contains the setting CONFIG_MODULE_COMPRESS_{GZIP,XZ,STD} we need to store the extension for a subsequent call to modinfo. Closes: https://bugs.gentoo.org/906303 Signed-off-by: Mike Pagano <mpagano@gentoo.org> eclass/linux-mod.eclass | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)