Debian 上的 VirtualBox

Debian 上的 VirtualBox

我安装了两个内核,3.5.0 和 3.6.0。由于多种原因,我必须运行内核 3.5.0。 VirtualBox 在 3.6.0 上完美运行,但在 3.5.0 上不行。

启动内核 3.5.0 后,我触发了 with 的模块重建apt-get --reinstall install virtualbox-dkms。这样就成功地重新编译了 VirtualBox 模块。但是,它无法加载。

# modprobe vboxdrv
ERROR: could not insert 'vboxdrv': Exec format error

/var/log/messages:

warning: `VirtualBox' uses 32-bit capabilities (legacy support in use)
vboxdrv: disagrees about version of symbol module_layout

该模块似乎已正确安装:

$ ls /lib/modules/3.5.0/updates/dkms/
vboxdrv.ko  vboxnetadp.ko  vboxnetflt.ko  vboxpci.ko

系统信息:Debian不稳定,软件包virtualbox-dkms已安装

$ uname -r
3.5.0

$ apt-cache show virtualbox | grep Version
Version: 4.1.18-dfsg-1.1

$ apt-cache show dkms | grep Version
Version: 2.2.0.3-1.2

这是模块构建的输出:

-------- Uninstall Beginning --------
Module:  virtualbox
Version: 4.1.18
Kernel:  3.5.0 (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.5.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetadp.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.5.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.5.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxpci.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.5.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

-------- Uninstall Beginning --------
Module:  virtualbox
Version: 4.1.18
Kernel:  3.6.0 (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.6.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetadp.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.6.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.6.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxpci.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.6.0/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

------------------------------
Deleting module version: 4.1.18
completely from the DKMS tree.
------------------------------
Done.
Unpacking replacement virtualbox-dkms ...
Setting up virtualbox-dkms (4.1.18-dfsg-1.1) ...
Loading new virtualbox-4.1.18 DKMS files...
Building for 3.5.0 and 3.6.0
Building initial module for 3.5.0
Done.

vboxdrv:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.5.0/updates/dkms/

vboxnetadp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.5.0/updates/dkms/

vboxnetflt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.5.0/updates/dkms/

vboxpci.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.5.0/updates/dkms/

depmod....

DKMS: install completed.
Building initial module for 3.6.0
Done.

vboxdrv:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.6.0/updates/dkms/

vboxnetadp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.6.0/updates/dkms/

vboxnetflt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.6.0/updates/dkms/

vboxpci.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.6.0/updates/dkms/

depmod....

DKMS: install completed.
[ ok ] Stopping VirtualBox kernel modules.
[FAIL] Starting VirtualBox kernel modules[....] modprobe vboxdrv failed. Please use 'dmesg' to find out why ... failed!
 failed!
invoke-rc.d: initscript virtualbox, action "restart" failed.

如何让 VirtualBox 在 3.5.0 上运行?

答案1

感谢术士的链接,我认为存在一些版本不匹配。我认为这是由于我没有创建kernel-source包造成的。相反,我使用了 git 存储库,该存储库也用于编译其他几个版本。

首先,我删除了软件包linux-imagelinux-headers (当前正在运行的内核)。

下一步是完全干净的签出(目录中不保留构建)。然后我构建了内核并创建了 packges linux-imagelinux-headerslinux-source并安装了它们。此后,VirtualBox 模块已构建并且加载成功。

我不知道之前哪些版本不匹配,但是遵循这些步骤可以保证不会出现版本不匹配的情况。

答案2

你安装了这个包吗virtualbox-dkms
我通常必须在每次内核升级后重新安装它,我认为这表明它的 dkms 部分已损坏,但重新安装它对我有用。除了新内核之外,我从未尝试过将其重新安装到任何其他内核上,但我认为它应该针对当前正在运行的任何内核进行构建。

相关内容