无法在 Ubuntu 11.10 64 位中安装或构建 VirtualBox 内核驱动程序

无法在 Ubuntu 11.10 64 位中安装或构建 VirtualBox 内核驱动程序

我正在尝试在 Ubuntu 11.10 上安装virtualbox-4.1(从 virtualbox.org apt 源),但它不会安装内核驱动程序:

 * 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

包含vbox-install.log

Uninstalling modules from DKMS
Attempting to install using DKMS

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

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;                               \
    /bin/false)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build 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

我已重新安装了 Linux 标头,但此目录中未出现 cache.h 文件。是否应尝试使用x86源或ia64

这似乎是因为第 26 行146-147 行x86segment.h标头包括:

#ifdef CONFIG_X86_32

#else
#include <asm/cache.h>

这是一个内核错误还是我应该强制进行一些 64 位编译?

更新:我现在认为拱门是正确的 -uname -a收益

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

答案1

似乎我丢失了一些文件。 sudo apt-get install --reinstall linux-headers-3.0.0.16-generic没有用,但是

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

确实如此。我大概需要做的就是

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

此后,sudo /etc/init.d/vboxdrv setup我的虚拟机就可以启动了。

相关内容