Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 505810 - sys-kernel/genkernel-3.4.45.1 - genkernel --no-install still installs modules
Summary: sys-kernel/genkernel-3.4.45.1 - genkernel --no-install still installs modules
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2014-03-25 20:54 UTC by Toralf Förster
Modified: 2020-08-04 09:44 UTC (History)
1 user (show)

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


Attachments
put module installation behind CMD_INSTALL (no-modules-install.patch,1.78 KB, patch)
2017-09-08 15:31 UTC, Ben Kohler
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2014-03-25 20:54:17 UTC
This command line :

$> ~/devel/tip $ sudo su -c "mount /boot; genkernel --makeopts=-j4 --kerneldir=`pwd` --no-install kernel ramdisk"

installs the modules in /lib/modules/3.11.0+

for the given kernel version)


Background :

I'd like to control this step with a separate  "make modules_install"

For bisecting I do not want pollute /boot with so many different files therefore I'm using currently this command sequence for bisecting a kernel bug:

~/devel/tip $ sudo su -c "mount /boot; cp /usr/src/linux-3.13.x/.config . && genkernel --clean --makeopts=-j4 --kerneldir=`pwd` kernel initramfs && cp arch/i386/boot/bzImage /boot/test && rm -rf /lib/modules/3.1?.0?* && make modules_install && mv /var/tmp/genkernel/initramfs* /boot/initramfs-test && sleep 6 && reboot"

and jutst pointed grub2 to "test" as the default menu item.
Comment 1 Ben Kohler gentoo-dev 2017-09-08 15:31:14 UTC
Created attachment 493226 [details, diff]
put module installation behind CMD_INSTALL

See if this patch looks sane.  Tested here and seems to work.  The attached patch is ugly due to indent changes, but here's the jist of it:


diff --git a/gen_compile.sh b/gen_compile.sh
index 1cd1ebf..fb818a7 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -308,6 +308,9 @@ compile_modules() {
        print_info 1 "        >> Compiling ${KV} modules..."
        cd ${KERNEL_DIR}
        compile_generic modules kernel
+
+       if isTrue "${CMD_INSTALL}"
+       then
                export UNAME_MACHINE="${ARCH}"
                [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
                if [ "${CMD_STRIP_TYPE}" == "all" -o "${CMD_STRIP_TYPE}" == "modules" ]
@@ -328,6 +331,7 @@ compile_modules() {
                fi
                unset UNAME_MACHINE
                unset INSTALL_MOD_STRIP
+       fi
 }
 
 compile_kernel() {
Comment 2 Larry the Git Cow gentoo-dev 2017-12-25 07:06:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5cab38a2aec2d6886eb8525240c83b3ee70b3d5d

commit 5cab38a2aec2d6886eb8525240c83b3ee70b3d5d
Author:     Robin H. Johnson <robbat2@gentoo.org>
AuthorDate: 2017-12-25 07:05:47 +0000
Commit:     Robin H. Johnson <robbat2@gentoo.org>
CommitDate: 2017-12-25 07:05:47 +0000

    gen_compile: modules should respect --no-install
    
    Closes: https://bugs.gentoo.org/505810
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

 gen_compile.sh | 4 ++++
 1 file changed, 4 insertions(+)
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-12-26 19:12:14 UTC
@bkohler:
Your solution introduced a breakage (both in it's original form and my equivilent patch)

Specifically, if you pass:
--no-install but want to create packages instead via --modulespackage/--minkernpackage, then it's not installed at all, and it can't create a modulepackage:

* Creating modules package
* Could not create a modules package /var/tmp/portage/sys-kernel/gentoo-infra-kernel-sources-4.14.8-r1/temp/lib/modules/4.14.8-gentoo-r1-infra37 was not found

I'm wondering if we need to seperate out the module install, and do a seperate tmpdir install for the package, and then if install is enabled, rsync from the tmpdir to final.
Comment 4 Ben Kohler gentoo-dev 2018-01-18 15:23:48 UTC
Been looking at this issue this morning.

These installed modules in /lib/modules/ are used by kerncache, minkernpackage, and modulespackage (if there are any more, please let me know).  

Where right now in compile_modules() we have recently added a simple "return" for NO_INSTALL, instead we should detect if any of those 3 features is set, and do an extra "make modules_install" with INSTALL_MOD_PATH="${TEMP}/no-install" set.  Then return.

Right now in those 3 functions using /lib/modules, we already have checks to use ${INSTALL_MOD_PATH}/lib/modules if it exists, we can add another check to use ${TEMP}/no-install/lib/modules if it exists.

Thoughts? Trying to get this done with minimal changes to the existing code.
Comment 5 Larry the Git Cow gentoo-dev 2019-07-29 20:10:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=15b34c0a3b9c63cbedc25db05081fc5e2ed00b67

commit 15b34c0a3b9c63cbedc25db05081fc5e2ed00b67
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-07-28 21:10:49 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-07-29 20:00:26 +0000

    genkernel: Don't install modules to /lib/modules when --kerncache is used but --no-install is set
    
    Bug: https://bugs.gentoo.org/505810
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 genkernel | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2020-08-02 22:42:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=febeae936c626eb4c0a44654cda2a6351671098b

commit febeae936c626eb4c0a44654cda2a6351671098b
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-08-02 22:01:21 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-08-02 22:42:11 +0000

    gen_determineargs.sh: determine_real_args(): Set KERNEL_MODULES_PREFIX to temporary location when --no-install is set
    
    This will ensure that we won't install anything on user's system when
    --no-install was set.
    
    While here, make use of expand_file() for --kernel-modules-prefix.
    
    Bug: https://bugs.gentoo.org/505810
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_determineargs.sh | 25 +++++++++++++++++++++++++
 genkernel            | 15 ---------------
 2 files changed, 25 insertions(+), 15 deletions(-)
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-04 09:44:42 UTC
Fix released with >=sys-kernel/genkernel-4.1.0_rc1!