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 .[31;01m*.[0m ERROR: app-emulation/virtualbox-modules-3.0.6 failed. .[31;01m*.[0m Call stack: .[31;01m*.[0m ebuild.sh, 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="$ (get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"; .[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 .[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 41.log'. .[31;01m*.[0m The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.6/temp/e nvironment'. .[31;01m*.[0m Expected Results: Should compile successfully Can be compiled if in every directory (vboxdrv, vboxnetadp, vboxnetflt) like calling make in Makefile is modified: replace $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules with $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) O=<correct path> -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules (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 :-))
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.
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..
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).
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).
Is this still an issue with virtualbox-modules-3.2.10?
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 :)
A fix is to change this line in the ebuild: BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}" to BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR}" 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).
*** Bug 373979 has been marked as a duplicate of this bug. ***
This appears to be fixed in all versions in the tree, is anyone still having a problem?
Created attachment 360070 [details] build.log (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 --- #!/bin/sh version="$1" ; shift image="$1" ; shift mount-portage.sh 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 "dirty".
*** Bug 488244 has been marked as a duplicate of this bug. ***
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() { linux-mod_pkg_setup - BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}" + BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR} KERNOUT=${KV_OUT_DIR}" enewgroup vboxusers }
Created attachment 361208 [details] build.log (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.
Confirming with latest app-emulation/virtualbox-modules-4.3.10 Patch works well
Confirming with latest app-emulation/virtualbox-modules-4.3.14 Patch works well
*** Bug 496048 has been marked as a duplicate of this bug. ***
*** Bug 500060 has been marked as a duplicate of this bug. ***
Confirming with latest app-emulation/virtualbox-modules-4.3.16 Patch works well
Confirming with latest stable app-emulation/virtualbox-modules-4.3.18 Patch works well How can i help to get it fixed?
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?
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. :-)
+ 14 Jun 2015; Michał Górny <mgorny@gentoo.org> + 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. https://github.com/gentoo + /gentoo-portage-rsync-mirror/pull/150 by nE0sIghT.
Hurray! Thanks a lot, Michał!
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 Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 local location: /var/lib/portage-local/local masters: gentoo priority: 0 testing location: /var/lib/portage-local/testing masters: gentoo priority: 1 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -mtune=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" 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" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y" 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" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu" MAKEOPTS="-j8" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" 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" PORTAGE_TMPDIR="/var/tmp" 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" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON ================================================================= Package Settings ================================================================= app-emulation/virtualbox-modules-5.1.12::gentoo was built with the following: USE="-pax_kernel" # emerge -pqv '=app-emulation/virtualbox-modules-5.1.12::gentoo' [ebuild R ] app-emulation/virtualbox-modules-5.1.12 USE="-pax_kernel"
(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`?
(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