Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 665324 - linux-mod.eclass: kernel modules fail to emerge: failed to create output directory "/lib/modules/4.9.74-unofficial+grsec/build"
Summary: linux-mod.eclass: kernel modules fail to emerge: failed to create output dire...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-06 04:36 UTC by Alex Efros
Modified: 2022-11-10 09:31 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 Alex Efros 2018-09-06 04:36:49 UTC
I suppose some eclass has changed which result in breaking emerge for kernel modules. E.g. I currently have installed app-emulation/virtualbox-modules-5.2.14, but if I try to re-emerge it I get this error (same error for nvidia-drivers):

# emerge -1av virtualbox-modules
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-emulation/virtualbox-modules-5.2.14::gentoo  USE="pax_kernel" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-5.2.14::gentoo
 * vbox-kernel-module-src-5.2.14.tar.xz BLAKE2B SHA512 size ;-) ...                          [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/4.9.74-unofficial+grsec/build
 * Found sources for kernel version:
 *     4.9.74-unofficial+grsec
 * Checking for suitable kernel configuration options...                                     [ ok ]
>>> Unpacking source...
>>> Unpacking vbox-kernel-module-src-5.2.14.tar.xz to /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work
>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work
>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
 * Applying virtualbox-modules-5.2.8-pax-const.patch ...                                     [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing vboxdrv module
make -j8 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' CC=x86_64-pc-linux-gnu-gcc KERN_DIR=/usr/src/linux KERN_VER=4.9.74-unofficial+grsec O=/lib/modules/4.9.74-unofficial+grsec/build V=1 KBUILD_VERBOSE=1 all 
=== Building 'vboxdrv' module ===
make[1]: Entering directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make V=1 CONFIG_MODULE_SIG= -C /usr/src/linux SUBDIRS=/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv SRCROOT=/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv -j8 modules
make[2]: Entering directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make[2]: warning: -jN forced in submake: disabling jobserver mode.
mkdir: cannot create directory ‘/lib/modules’: Permission denied
Makefile:141: *** failed to create output directory "/lib/modules/4.9.74-unofficial+grsec/build".  Stop.
make[2]: Leaving directory '/usr/src/linux-unofficial_grsec'
make[1]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv/Makefile.include.footer:101: vboxdrv] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make: *** [Makefile:49: all] Error 2
 * ERROR: app-emulation/virtualbox-modules-5.2.14::gentoo failed (compile phase):
 *   emake failed


# ls -ld /usr/src/linux*
lrwxrwxrwx  1 root root   22 Nov  4  2017 /usr/src/linux -> linux-unofficial_grsec
drwxr-xr-x 27 root root 4096 Jul 16 20:56 /usr/src/linux-unofficial_grsec

# ls -ld /lib /lib64 /lib/modules /lib/modules/4.9.74-unofficial+grsec /lib/modules/4.9.74-unofficial+grsec/build
lrwxrwxrwx  1 root root     5 Jun 20 07:36 /lib -> lib64
dr-x------ 14 root root  4096 Jan  4  2018 /lib/modules
drwxr-xr-x  5 root root  4096 Jul 23 00:55 /lib/modules/4.9.74-unofficial+grsec
lrwxrwxrwx  1 root root    31 Jan  4  2018 /lib/modules/4.9.74-unofficial+grsec/build -> /usr/src/linux-unofficial_grsec
drwxr-xr-x 13 root root 12288 Aug 25 03:46 /lib64
Comment 1 Alex Efros 2018-09-12 04:57:52 UTC
I've just installed gentoo-sources and get same error:

# ls -ld /usr/src/linux*
lrwxrwxrwx  1 root root   20 Sep 12 07:41 /usr/src/linux -> linux-4.9.122-gentoo
drwxr-xr-x 26 root root 4096 Sep 12 07:49 /usr/src/linux-4.9.122-gentoo

# ls -ld /lib /lib64 /lib/modules /lib/modules/4.9.122-gentoo /lib/modules/4.9.122-gentoo/build
lrwxrwxrwx  1 root root     5 Jun 20 07:36 /lib -> lib64
dr-x------ 15 root root  4096 Sep 12 07:49 /lib/modules
drwxr-xr-x  3 root root  4096 Sep 12 07:49 /lib/modules/4.9.122-gentoo
lrwxrwxrwx  1 root root    29 Sep 12 07:49 /lib/modules/4.9.122-gentoo/build -> /usr/src/linux-4.9.122-gentoo
drwxr-xr-x 13 root root 12288 Aug 25 03:46 /lib64

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-5.2.14::gentoo
 * vbox-kernel-module-src-5.2.14.tar.xz BLAKE2B SHA512 size ;-) ...                          [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/4.9.122-gentoo/build
 * Found sources for kernel version:
 *     4.9.122-gentoo
 * Checking for suitable kernel configuration options...                                     [ ok ]
>>> Unpacking source...
>>> Unpacking vbox-kernel-module-src-5.2.14.tar.xz to /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work
>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work
>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
 * Applying virtualbox-modules-5.2.8-pax-const.patch ...                                     [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing vboxdrv module
make -j8 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' CC=x86_64-pc-linux-gnu-gcc KERN_DIR=/usr/src/linux KERN_VER=4.9.122-gentoo O=/lib/modules/4.9.122-gentoo/build V=1 KBUILD_VERBOSE=1 all 
=== Building 'vboxdrv' module ===
make[1]: Entering directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make V=1 CONFIG_MODULE_SIG= -C /usr/src/linux SUBDIRS=/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv SRCROOT=/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv -j8 modules
make[2]: Entering directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make[2]: warning: -jN forced in submake: disabling jobserver mode.
mkdir: cannot create directory ‘/lib/modules’: Permission denied
Makefile:143: *** failed to create output directory "/lib/modules/4.9.122-gentoo/build".  Stop.
make[2]: Leaving directory '/usr/src/linux-4.9.122-gentoo'
make[1]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv/Makefile.include.footer:101: vboxdrv] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.2.14/work/vboxdrv'
make: *** [Makefile:49: all] Error 2
 * ERROR: app-emulation/virtualbox-modules-5.2.14::gentoo failed (compile phase):
 *   emake failed
Comment 2 Alex Efros 2018-09-14 06:22:55 UTC
I've bisect it to this commit: https://github.com/gentoo/gentoo/commit/50078fbbb3966773401c1fc59838c1e5952c1318

Reverting it fixes the issue.
Comment 3 Alex Efros 2018-09-14 06:30:46 UTC
Not sure is this important, but just in case:

# zgrep LOCALVER /proc/config.gz
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y

# cat /usr/src/linux/include/config/kernel.release
4.9.74-unofficial+grsec

# uname -r
4.9.74-unofficial+grsec
Comment 4 Mike Pagano gentoo-dev 2022-11-09 13:01:10 UTC
(In reply to Alex Efros from comment #3)
> Not sure is this important, but just in case:
> 
> # zgrep LOCALVER /proc/config.gz
> CONFIG_LOCALVERSION=""
> CONFIG_LOCALVERSION_AUTO=y
> 
> # cat /usr/src/linux/include/config/kernel.release
> 4.9.74-unofficial+grsec
> 
> # uname -r
> 4.9.74-unofficial+grsec

I'm having trouble recreating this.

You reported it happened with gentoo-sources, can you give me the above info for gentoo-sources ?

Also, can you recreate with:

ECLASS_DEBUG_OUTPUT=on
Comment 5 Alex Efros 2022-11-10 09:29:41 UTC
(In reply to Mike Pagano from comment #4)
> I'm having trouble recreating this.

Probably because it was reported 4 years ago.

I don't have this issue now, so feel free to close it.