Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install virtualbox-4.1 (from the apt source) on Ubuntu 11.10 and it will not install the kernel driver:

 * Stopping VirtualBox kernel modules                                    [ OK ] 
 * Uninstalling old VirtualBox DKMS kernel modules                       [ OK ] 
 * Trying to register the VirtualBox kernel modules using DKMS                  Error! Bad return status for module build on kernel: 3.0.0-16-generic (x86_64)
Consult /var/lib/dkms/vboxhost/4.1.8/build/make.log for more information.

 * Failed, trying without DKMS
 * Recompiling VirtualBox kernel modules                                        
 * Look at /var/log/vbox-install.log to find out what went wrong

the vbox-install.log contains:

Uninstalling modules from DKMS
Attempting to install using DKMS

Creating symlink /var/lib/dkms/vboxhost/4.1.8/source ->

DKMS: add Completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.0.0-16-generic -C /lib/modules/3.0.0-16-generic/build M=/var/lib/dkms/vboxhost/4.1.8/build....(bad exit status: 2)
Failed to install using DKMS, attempting to install without
make KBUILD_VERBOSE=1 SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 CONFIG_MODULE_SIG= -C /lib/modules/3.0.0-16-generic/build modules
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (    \
    echo;                               \
    echo "  ERROR: Kernel configuration is invalid.";       \
    echo "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
    echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
    echo;                               \
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/ obj=/tmp/vbox.0
  gcc -Wp,-MD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include  -I/usr/src/linux-headers-3.0.0-16-generic/arch/x86/include -Iarch/x86/include/generated -Iinclude  -include include/generated/autoconf.h -Iubuntu/include  -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=1024 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -I/lib/modules/3.0.0-16-generic/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxdrv/ -I/tmp/vbox.0/vboxdrv/include -I/tmp/vbox.0/vboxdrv/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(SUPDrv_linux)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxdrv)" -c -o /tmp/vbox.0/linux/.tmp_SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c
In file included from /usr/src/linux-headers-3.0.0-16-generic/arch/x86/include/asm/ptrace.h:9:0,
                 from /usr/src/linux-headers-3.0.0-16-generic/arch/x86/include/asm/vm86.h:130,
                 from /usr/src/linux-headers-3.0.0-16-generic/arch/x86/include/asm/processor.h:10,
                 from /usr/src/linux-headers-3.0.0-16-generic/arch/x86/include/asm/thread_info.h:22,
                 from include/linux/thread_info.h:53,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from /tmp/vbox.0/linux/../SUPDrvInternal.h:103,
                 from /tmp/vbox.0/linux/SUPDrv-linux.c:31:
/usr/src/linux-headers-3.0.0-16-generic/arch/x86/include/asm/segment.h:148:23: fatal error: asm/cache.h: No such file or directory
compilation terminated.
make[2]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] Error 1
make[1]: *** [_module_/tmp/vbox.0] Error 2
make: *** [vboxdrv] Error 2

I've reinstalled the linux headers and the cache.h file does not appear in this directory. Should it be trying to use x86 sources or ia64?

This appears to be because of line 26 and lines 146-147 of the x86 segment.h header which are:

#ifdef CONFIG_X86_32


#include <asm/cache.h>

Is this a kernel bug or should I be forcing some 64bit compilation?

Update: I now think the arch is correct - uname -a yeilds

Linux stephenk 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

share|improve this question
up vote 0 down vote accepted

It seems I lost some files. sudo apt-get install --reinstall linux-headers- did not work, but

sudo apt-get remove linux-headers-
sudo apt-get install linux-headers-

did. Presumably all I needed to do was

sudo apt-get install --reinstall linux-headers-

After this, sudo /etc/init.d/vboxdrv setup works and my VMs can launch.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .