Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 285866 - app-emulation/virtualbox-modules-3.0.6 doesn't support kernel objtree!=srctree
Summary: app-emulation/virtualbox-modules-3.0.6 doesn't support kernel objtree!=srctree
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: Patrick Lauer
: 373979 488244 496048 500060 (view as bug list)
Depends on:
Reported: 2009-09-21 22:15 UTC by Honza
Modified: 2017-01-13 09:38 UTC (History)
13 users (show)

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

build.log (build.log,30.78 KB, text/x-log)
2013-10-03 15:20 UTC, Dennis Schridde
build.log (build.log,4.94 KB, text/x-log)
2013-10-18 10:38 UTC, Dennis Schridde
A patch for current virtualbox-modules-4.3.26 using O= option. (virtualbox-modules-with-out-of-source-build.patch,122 bytes, patch)
2015-03-18 13:29 UTC, Jan-Matthias Braun
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Honza 2009-09-21 22:15:24 UTC
app-emulation/virtualbox-modules-3.0.6 doesn't support kernel objtree at different path that kernel srctree.

Reproducible: Always

Steps to Reproduce:
1. have objtree!=srctree
2. emerge app-emulation/virtualbox-modules

Actual Results:  
make KBUILD_VERBOSE= -C /usr/src/linux-2.6.30-gentoo-r5 SUBDIRS=/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/
work/vboxdrv SRCROOT=/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/work/vboxdrv modules
make[2]: Entering directory `/usr/src/linux-2.6.30-gentoo-r5'

  ERROR: Kernel configuration is invalid.
         include/linux/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

  WARNING: Symbol version dump /usr/src/linux-2.6.30-gentoo-r5/Module.symvers
           is missing; modules will have no dependencies and modversions.

make[3]: *** [/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/work/vboxdrv/SUPDrv.o] Error 1
make[2]: *** [_module_/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/work/vboxdrv] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.30-gentoo-r5'
make[1]: *** [vboxdrv] Error 2
make[1]: Leaving directory `/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/work/vboxdrv'
make: *** [all] Error 2
 .[31;01m*.[0m ERROR: app-emulation/virtualbox-modules-3.0.6 failed.
 .[31;01m*.[0m Call stack:
 .[31;01m*.[0m     , line   49:  Called src_compile
 .[31;01m*.[0m             environment, line 3354:  Called linux-mod_src_compile
 .[31;01m*.[0m             environment, line 2584:  Called die
 .[31;01m*.[0m The specific snippet of code:
 .[31;01m*.[0m               eval "emake HOSTCC="$(tc-getBUILD_CC)"                                             CROSS_CO
MPILE=${CHOST}-                                                 LDFLAGS="$(get_abi_LDFLAGS)"
                ${BUILD_FIXES}                                          ${BUILD_PARAMS}
                ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$
 .[31;01m*.[0m  The die message:
 .[31;01m*.[0m   Unable to emake HOSTCC=i686-pc-linux-gnu-gcc CROSS_COMPILE=i686-pc-linux-gnu- LDFLAGS=  KERN_DIR=/usr/s
rc/linux-2.6.30-gentoo-r5 KERNOUT=/usr/src/linux-2.6.30-gentoo-r5-32 all
 .[31;01m*.[0m If you need support, post the topmost build error, and the call stack if relevant.
 .[31;01m*.[0m A complete build log is located at '/var/log/portage/app-emulation:virtualbox-modules-3.0.6:20090921-1409
 .[31;01m*.[0m The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/temp/e

Expected Results:  
Should compile successfully

Can be compiled if in every directory (vboxdrv, vboxnetadp, vboxnetflt) like calling make in Makefile is modified: replace




(I assume modification of parent makefile will be needed to get the correct path there in some variable ... I made it compile by adding O=$(KERN_DIR)-32, but that is hardly universal :-))
Comment 1 Honza 2009-09-21 22:40:27 UTC
Hmmm ... when I try to run some image, VirtualBox reports:

RTR3Init failed with rc=-1912 (rc=-1912)

The VirtualBox kernel modules do not fit to this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing

'/etc/init.d/vboxdrv setup'

should fix that problem. Make sure that you don't mix the OSE version and the PUEL version of VirtualBox.


and I didn't even HAVE the /etc/init.d/vboxdrv file ... so, while my fix made it compile, I cannot confirm if it's really working.
Comment 2 Alessio Cassibba (X-Drum) 2009-11-01 18:50:02 UTC
So, if i'm not wrong, you are storing your current kernel objtree in another
location (for istance different from the standard one).

As far i can tell all the ebuilds (for/with kernel modules) should fail
in this specific situation, for istance they rely on the linux-mod eclass 
to "guess" the current kernel name and objtree dir..
Comment 3 Honza 2009-11-02 08:24:31 UTC
Surprisingly, most will get it right :-). See for example lm-sensors or svgalib. 

With some setups, it is necessary to explicitly define KBUILD_OUTPUT and KERNEL_DIR (on commandline or in make.conf), but for many will get_version from linux-info.eclass correctly guess both values (I've been told: it's true that I personaly have another bug - 87242 - open for the version of guessing I need).
Comment 4 Honza 2010-01-16 23:14:10 UTC
app-emulation/virtualbox-modules-3.0.12 and app-emulation/virtualbox-modules-3.1.0 have exactly same problem. Not sure if something changed, but this time I found out that adding O=$(KERNOUT) works correctly (and, unlike previous workaround, should work for ANY objtree!=srctree configuration and not just the mine).
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-11-01 17:33:27 UTC
Is this still an issue with virtualbox-modules-3.2.10?
Comment 6 Dmitry Bigunyak 2010-11-26 11:21:54 UTC
I've got the same problem with virtualbox-bin-3.2.10-r1
I was trying to google the problem but didn't find anything helpful.
After that I guessed to reload virtualbox modules in the RAM and it helps!
So, try to do this:

type lsmod, you'll get:
Module                  Size  Used by
vboxnetflt             14080  0
vboxnetadp              5072  0
vboxdrv              1723292  3 vboxnetflt,vboxnetadp

now, unload modules:
modprobe -r vboxnetflt
modprobe -r vboxnetadp
modprobe -r vboxdrv

and load them again:
modprobe vboxdrv
modprobe vboxnetflt
modprobe vboxnetadp

Hope it helps :)
Comment 7 Ambroz Bizjak 2012-08-10 14:32:33 UTC
A fix is to change this line in the ebuild:




This way it will build fine, since the Makefile in the build dir is hooked up to redirect to the kernel source dir (which is hardcoded into that Makefile), but with proper O= argument (the build dir).
Comment 8 Ben Kohler gentoo-dev 2013-10-02 02:42:04 UTC
*** Bug 373979 has been marked as a duplicate of this bug. ***
Comment 9 Ben Kohler gentoo-dev 2013-10-02 02:43:47 UTC
This appears to be fixed in all versions in the tree, is anyone still having a problem?
Comment 10 Dennis Schridde 2013-10-03 15:20:01 UTC
Created attachment 360070 [details]

(In reply to Ben Kohler from comment #9)
> This appears to be fixed in all versions in the tree, is anyone still having
> a problem?

Yes, I do. I use gentoo-sources-3.11.3 and virtualbox-4.2.18 and wrote the following postinst file:
# cat /etc/kernel/postinst.d/00_module-rebuild

version="$1" ; shift
image="$1" ; shift

mount -o remount,rw /usr
mount -o remount,rw /opt

#export KERNEL_DIR="/lib/modules/${version}/source"
#export KBUILD_OUTPUT="/lib/modules/${version}/build"
export KERNEL_DIR="/usr/src/linux-${version}"
export KBUILD_OUTPUT="/root/build-${version}"

unset ARCH

emerge @module-rebuild || exit 0

This creates sandbox violations, like:
 * ACCESS DENIED:  open_wr:      /usr/src/linux-3.11.3-gentoo/.22288.tmp
 * ACCESS DENIED:  unlinkat:     /usr/src/linux-3.11.3-gentoo/.22288.tmp
rm: cannot remove ‘.22288.tmp’: Permission denied

It compiles, if I am compiling for the same version as the one that is currently running, but not if ${version} and $(uname -r) disagree.

On a sidenote: The failed module rebuild still seems to messup the kernel source directory, even with the sandbox, because whenever I run make in the build directory afterwards, I get:
  Using /usr/src/linux-3.11.2-gentoo as source for kernel
  /usr/src/linux-3.11.2-gentoo is not clean, please run 'make mrproper'
  in the '/usr/src/linux-3.11.2-gentoo' directory.

I then run
# make -C /usr/src/linux-3.11.2-gentoo mrproper
and after running make install in the kernel build directory, they are again
Comment 11 Ben Kohler gentoo-dev 2013-10-16 16:47:58 UTC
*** Bug 488244 has been marked as a duplicate of this bug. ***
Comment 12 nE0sIghT 2013-10-16 17:36:55 UTC
Fix from comment #7 works fine:

--- ../../../../../portage/app-emulation/virtualbox-modules/virtualbox-modules-4.3.0.ebuild	2013-10-15 17:24:20.000000000 +0400
+++ ./virtualbox-modules-4.3.0.ebuild	2013-10-16 19:25:23.943534399 +0400
@@ -30,7 +30,7 @@
 pkg_setup() {
 	enewgroup vboxusers
Comment 13 Dennis Schridde 2013-10-18 10:38:35 UTC
Created attachment 361208 [details]

(In reply to nE0sIghT from comment #12)

I ran into attached problem with app-emulation/virtualbox-modules-4.3.0 and the patch from comment #7 indeed fixed the issue.
Comment 14 nE0sIghT 2014-03-26 15:23:32 UTC
Confirming with latest app-emulation/virtualbox-modules-4.3.10
Patch works well
Comment 15 nE0sIghT 2014-07-19 07:43:51 UTC
Confirming with latest app-emulation/virtualbox-modules-4.3.14
Patch works well
Comment 16 Ben Kohler gentoo-dev 2014-08-08 02:14:01 UTC
*** Bug 496048 has been marked as a duplicate of this bug. ***
Comment 17 Ben Kohler gentoo-dev 2014-08-08 02:14:19 UTC
*** Bug 500060 has been marked as a duplicate of this bug. ***
Comment 18 nE0sIghT 2014-09-11 15:13:18 UTC
Confirming with latest app-emulation/virtualbox-modules-4.3.16
Patch works well
Comment 19 nE0sIghT 2014-12-23 16:08:05 UTC
Confirming with latest stable app-emulation/virtualbox-modules-4.3.18
Patch works well

How can i help to get it fixed?
Comment 20 Dani Church 2015-01-03 01:50:10 UTC
This is still causing problems; I just stumbled across this with virtualbox-modules-4.3.20 and had to fix it myself.

We have a working patch; can we get this into the portage tree, please?
Comment 21 Jan-Matthias Braun 2015-03-18 13:29:38 UTC
Created attachment 399190 [details, diff]
A patch for current virtualbox-modules-4.3.26 using O= option.

It uses the O option as the original kernel make command I am using to do the out of source build and it works for me, but I don't know if this is the way it should be solved. :-)
Comment 22 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-06-14 18:12:57 UTC
+  14 Jun 2015; Michał Górny <>
+  virtualbox-modules-4.3.18.ebuild, virtualbox-modules-4.3.26.ebuild,
+  virtualbox-modules-4.3.28.ebuild:
+  Fix build with objtree!=srctree, bug #285866.
+  /gentoo-portage-rsync-mirror/pull/150 by nE0sIghT.
Comment 23 Dennis Schridde 2015-06-14 20:49:52 UTC
Hurray! Thanks a lot, Michał!
Comment 24 tka 2017-01-09 19:13:48 UTC
Now, the (re-)build fails for me:

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-5.1.12::gentoo
 * vbox-kernel-module-src-5.1.12.tar.xz SHA256 SHA512 WHIRLPOOL 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.2/build
 * Found sources for kernel version:
 *     4.9.2
 * Checking for suitable kernel configuration options...                                                                                                                                                                     [ ok ]
>>> Unpacking source...
>>> Unpacking vbox-kernel-module-src-5.1.12.tar.xz to /var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work
>>> Source unpacked in /var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work
>>> Preparing source in /var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing vboxdrv module
make -j1 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' KERN_DIR=/usr/src/linux O=/lib/modules/4.9.2/build V=1 KBUILD_VERBOSE=1 all 
*** Building 'vboxdrv' module ***
make[1]: Entering directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work/vboxdrv'
make KBUILD_VERBOSE=1 SUBDIRS=/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work/vboxdrv SRCROOT=/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work/vboxdrv CONFIG_MODULE_SIG= -C /usr/src/linux -j8 modules
make[2]: Entering directory '/usr/src/linux-4.9'
mkdir: cannot create directory ‘/lib/modules/4.9.2’: Permission denied
Makefile:141: *** failed to create output directory "/lib/modules/4.9.2/build".  Stop.
make[2]: Leaving directory '/usr/src/linux-4.9'
make[1]: *** [Makefile:303: vboxdrv] Error 2
make[1]: Leaving directory '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work/vboxdrv'
make: *** [Makefile:41: all] Error 2
 * ERROR: app-emulation/virtualbox-modules-5.1.12::gentoo failed (compile phase):
 *   emake failed
 * If you need support, post the output of `emerge --info '=app-emulation/virtualbox-modules-5.1.12::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-emulation/virtualbox-modules-5.1.12::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/temp/environment'.
 * Working directory: '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work'
 * S: '/var/tmp/portage/app-emulation/virtualbox-modules-5.1.12/work'

>>> Failed to emerge app-emulation/virtualbox-modules-5.1.12, Log file:

# emerge --info '=app-emulation/virtualbox-modules-5.1.12::gentoo'
Portage 2.3.3 (python 3.4.5-final-0, hardened/linux/amd64/no-multilib, gcc-5.4.0, glibc-2.23-r3, 4.9.1 x86_64)
                         System Settings
System uname: Linux-4.9.1-x86_64-Intel-R-_Core-TM-_i7-3720QM_CPU_@_2.60GHz-with-gentoo-2.3
KiB Mem:    16398680 total,  11810704 free
KiB Swap:   17825788 total,  17825788 free
Timestamp of repository gentoo: Mon, 09 Jan 2017 19:00:01 +0000
sh bash 4.4_p5-r1
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p5-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.7.1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.1::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r2::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /var/lib/portage-local/local
    masters: gentoo
    priority: 0

    location: /var/lib/portage-local/testing
    masters: gentoo
    priority: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X a52 acl acpi alsa amd64 avx berkdb bzip2 cairo caps cdda cddb cdparanoia cli cracklib crypt cups cxx dbus dri dts dvd fam ffmpeg fftw flac fontconfig foomaticdb gdbm gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 jpeg justify lame lcms libnotify lzma mad matroska mmap mmx mmxext modules mp3 mpeg ncurses networkmanager nptl ogg opengl openmp pam pcre pie png policykit ppds readline sasl sdl seccomp session sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower vaapi vorbis wayland x264 xattr xcb xinerama xml xtpax xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="i965 intel nouveau" XFCE_PLUGINS="power" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

                        Package Settings

app-emulation/virtualbox-modules-5.1.12::gentoo was built with the following:

# emerge -pqv '=app-emulation/virtualbox-modules-5.1.12::gentoo'
[ebuild   R   ] app-emulation/virtualbox-modules-5.1.12  USE="-pax_kernel"
Comment 25 nE0sIghT 2017-01-09 19:23:13 UTC
(In reply to tka from comment #24)
> Now, the (re-)build fails for me:
>  * Found kernel object directory:
>  *     /lib/modules/4.9.2/build

Could you please show output of `ls -l /lib/modules/4.9.2/build`?
Comment 26 tka 2017-01-13 09:38:15 UTC
(In reply to nE0sIghT from comment #25)
> (In reply to tka from comment #24)
> > Now, the (re-)build fails for me:
> >  * Found kernel object directory:
> >  *     /lib/modules/4.9.2/build
> Could you please show output of `ls -l /lib/modules/4.9.2/build`?

# ls -l /lib/modules/4.9.2/build
lrwxrwxrwx 1 root root 18 Jan  9 19:39 /lib/modules/4.9.2/build -> /usr/src/linux-4.9