为了安装 VirtualBox(基本上如其所述这里在我的 Ubuntu 18.04 机器上,我运行以下命令
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo apt-get update
它们都运行良好。但对于
sudo apt-get install virtualbox-5.2
我收到错误:
The following packages have unmet dependencies:
virtualbox-5.2 : Depends: libqt5opengl5 (>= 5.0.2) but it is not installable
Depends: libqt5printsupport5 (>= 5.0.2) but it is not installable
Depends: libqt5x11extras5 (>= 5.6.0) but it is not installable
Depends: libsdl1.2debian (>= 1.2.11) but it is not installable
Recommends: libsdl-ttf2.0-0 but it is not installable
E: Unable to correct problems, you have held broken packages.
当我使用默认的 Ubuntu 存储库时,安装返回了与描述完全一致的错误这里。
安装后,我无法启动任何虚拟机(例如NAME
),并且出现错误
WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-dkms package and the appropriate
headers, most likely linux-headers-generic.
You will not be able to start VMs until this problem is fixed.
Waiting for VM "NAME" to power on...
VBoxManage: error: The virtual machine 'NAME' has terminated unexpectedly during startup with exit code 1 (0x1)
当然,virtualbox-dkms
包已经安装了。
模型名称(cat /proc/cpuinfo | grep "model name" | uniq
)为Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz
并grep -E "svm|vmx" /proc/cpuinfo | wc -l
返回 4。
根据建议梅莱比乌斯,运行后的完整输出如下sudo dpkg-reconfigure virtualbox-dkms
:
-------- Uninstall Beginning --------
Module: virtualbox
Version: 5.2.10
Kernel: 4.15.0-30-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
vboxdrv.ko:
- Uninstallation
- Deleting from: /lib/modules/4.15.0-30-generic/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/4.15.0-30-generic/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/4.15.0-30-generic/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/4.15.0-30-generic/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: 5.2.10
Kernel: 4.15.0-33-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
vboxdrv.ko:
- Uninstallation
- Deleting from: /lib/modules/4.15.0-33-generic/
rmdir: failed to remove '': No such file or directory
- 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/4.15.0-33-generic/
rmdir: failed to remove '': No such file or directory
- 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/4.15.0-33-generic/
rmdir: failed to remove '': No such file or directory
- 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/4.15.0-33-generic/
rmdir: failed to remove '': No such file or directory
- 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: 5.2.10
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-5.2.10 DKMS files...
Building for 4.15.0-30-generic 4.15.0-33-generic
Building initial module for 4.15.0-30-generic
Done.
vboxdrv:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.15.0-30-generic/updates/dkms/
vboxnetadp.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.15.0-30-generic/updates/dkms/
vboxnetflt.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.15.0-30-generic/updates/dkms/
vboxpci.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.15.0-30-generic/updates/dkms/
depmod...
DKMS: install completed.
Building initial module for 4.15.0-33-generic
Done.
vboxdrv:
Running module version sanity check.
modinfo: ERROR: could not get modinfo from 'vboxdrv': Invalid argument
- Original module
- Installation
- Installing to /lib/modules/4.15.0-33-generic/updates/dkms/
vboxnetadp.ko:
Running module version sanity check.
modinfo: ERROR: could not get modinfo from 'vboxnetadp': Invalid argument
- Original module
- Installation
- Installing to /lib/modules/4.15.0-33-generic/updates/dkms/
vboxnetflt.ko:
Running module version sanity check.
modinfo: ERROR: could not get modinfo from 'vboxnetflt': Invalid argument
- Original module
- Installation
- Installing to /lib/modules/4.15.0-33-generic/updates/dkms/
vboxpci.ko:
Running module version sanity check.
modinfo: ERROR: could not get modinfo from 'vboxpci': Invalid argument
- Original module
- Installation
- Installing to /lib/modules/4.15.0-33-generic/updates/dkms/
depmod...
DKMS: install completed.
Job for virtualbox.service failed because the control process exited with error code.
See "systemctl status virtualbox.service" and "journalctl -xe" for details.
invoke-rc.d: initscript virtualbox, action "restart" failed.
● virtualbox.service - LSB: VirtualBox Linux kernel module
Loaded: loaded (/etc/init.d/virtualbox; generated)
Active: failed (Result: exit-code) since Mon 2018-08-27 15:38:36 UTC; 5ms ago
Docs: man:systemd-sysv-generator(8)
Process: 9229 ExecStart=/etc/init.d/virtualbox start (code=exited, status=1/FAILURE)
Aug 27 15:38:36 cmsuite-build-machine systemd[1]: Starting LSB: VirtualBox Linux kernel module...
Aug 27 15:38:36 cmsuite-build-machine virtualbox[9229]: * Loading VirtualBox kernel modules...
Aug 27 15:38:36 cmsuite-build-machine virtualbox[9229]: * modprobe vboxdrv failed. Please use 'dmesg' to find out why
Aug 27 15:38:36 cmsuite-build-machine virtualbox[9229]: ...fail!
Aug 27 15:38:36 cmsuite-build-machine systemd[1]: virtualbox.service: Control process exited, code=exited status=1
Aug 27 15:38:36 cmsuite-build-machine systemd[1]: virtualbox.service: Failed with result 'exit-code'.
Aug 27 15:38:36 cmsuite-build-machine systemd[1]: Failed to start LSB: VirtualBox Linux kernel module.
我究竟做错了什么?
答案1
我遇到了同样的问题。我建议你禁用可信平台管理以及 UEFI 设置中的 SecureBoot。