无法在 Ubuntu 16.04.2 LTS 上启动 virtualbox

无法在 Ubuntu 16.04.2 LTS 上启动 virtualbox

我已经正确安装并使用了 VirtualBox。但是,从昨天开始,我在启动 VirtualBox 时收到此错误:

root@batzi-xubuntu:/home/batzinger# virtualbox
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.
Qt WARNING: Qt: Session management error: Authentication Rejected, reason : 
None of the authentication protocols specified are supported and host-based authentication failed

我也关注了这个问题但什么都没有改变。运行 sudo apt-get --reinstall install virtualbox-dkms 后,我得到以下输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-64 linux-headers-4.4.0-64-generic linux-image-4.4.0-64-generic linux-image-extra-4.4.0-64-generic linux-signed-image-4.4.0-64-generic
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/622 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 240869 files and directories currently installed.)
Preparing to unpack .../virtualbox-dkms_5.0.32-dfsg-0ubuntu1.16.04.2_all.deb ...

------------------------------
Deleting module version: 5.0.32
completely from the DKMS tree.
------------------------------
Done.
Unpacking virtualbox-dkms (5.0.32-dfsg-0ubuntu1.16.04.2) over (5.0.32-dfsg-0ubuntu1.16.04.2) ...
Setting up virtualbox-dkms (5.0.32-dfsg-0ubuntu1.16.04.2) ...
Loading new virtualbox-5.0.32 DKMS files...
Building only for 4.4.0-71-generic
Building initial module for 4.4.0-71-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/virtualbox-dkms.0.crash'
Error! Bad return status for module build on kernel: 4.4.0-71-generic (x86_64)
Consult /var/lib/dkms/virtualbox/5.0.32/build/make.log for more information.
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; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Di 2017-04-04 19:55:06 CEST; 10ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2793 ExecStart=/etc/init.d/virtualbox start (code=exited, status=1/FAILURE)

Apr 04 19:55:06 batzi-xubuntu systemd[1]: Starting LSB: VirtualBox Linux kernel module...
Apr 04 19:55:06 batzi-xubuntu virtualbox[2793]:  * Loading VirtualBox kernel modules...
Apr 04 19:55:06 batzi-xubuntu virtualbox[2793]:  * No suitable module for running kernel found
Apr 04 19:55:06 batzi-xubuntu virtualbox[2793]:    ...fail!
Apr 04 19:55:06 batzi-xubuntu systemd[1]: virtualbox.service: Control process exited, code=exited status=1
Apr 04 19:55:06 batzi-xubuntu systemd[1]: Failed to start LSB: VirtualBox Linux kernel module.
Apr 04 19:55:06 batzi-xubuntu systemd[1]: virtualbox.service: Unit entered failed state.
Apr 04 19:55:06 batzi-xubuntu systemd[1]: virtualbox.service: Failed with result 'exit-code'.

好吧,也许有人有其他想法?

编辑: 的输出uname -r4.4.0-66-genericdkms statusvirtualbox, 5.0.32: added

root@batzi-xubuntu:/# dpkg -l *virtualbox* | grep ii
ii  virtualbox                     5.0.32-dfsg-0ubuntu1.16.04.2 amd64        x86 virtualization solution - base binaries
ii  virtualbox-dkms                5.0.32-dfsg-0ubuntu1.16.04.2 all          x86 virtualization solution - kernel module sources for dkms
ii  virtualbox-guest-utils         5.0.32-dfsg-0ubuntu1.16.04.2 amd64        x86 virtualization solution - non-X11 guest utilities
ii  virtualbox-guest-x11           5.0.32-dfsg-0ubuntu1.16.04.2 amd64        x86 virtualization solution - X11 guest utilities
ii  virtualbox-qt                  5.0.32-dfsg-0ubuntu1.16.04.2 amd64        x86 virtualization solution - Qt based user interface
ii  virtualbox-source              5.0.32-dfsg-0ubuntu1.16.04.2 all          x86 virtualization solution - kernel module source

secure boot被禁用

输出cat /var/lib/dkms/virtualbox/5.0.32/build/make.log

DKMS make.log for virtualbox-5.0.32 for kernel 4.4.0-71-generic (x86_64)
Di 4. Apr 19:54:59 CEST 2017
make: Entering directory '/usr/src/linux-headers-4.4.0-71-generic'
arch/x86/Makefile:133: stack-protector enabled but compiler support broken
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
Makefile:693: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make: execvp: gcc: Permission denied
  LD      /var/lib/dkms/virtualbox/5.0.32/build/built-in.o
  LD      /var/lib/dkms/virtualbox/5.0.32/build/vboxdrv/built-in.o
  CC [M]  /var/lib/dkms/virtualbox/5.0.32/build/vboxdrv/linux/SUPDrv-linux.o
/bin/sh: 1: gcc: Permission denied
scripts/Makefile.build:258: recipe for target '/var/lib/dkms/virtualbox/5.0.32/build/vboxdrv/linux/SUPDrv-linux.o' failed
make[2]: *** [/var/lib/dkms/virtualbox/5.0.32/build/vboxdrv/linux/SUPDrv-linux.o] Error 126
scripts/Makefile.build:403: recipe for target '/var/lib/dkms/virtualbox/5.0.32/build/vboxdrv' failed
make[1]: *** [/var/lib/dkms/virtualbox/5.0.32/build/vboxdrv] Error 2
Makefile:1420: recipe for target '_module_/var/lib/dkms/virtualbox/5.0.32/build' failed
make: *** [_module_/var/lib/dkms/virtualbox/5.0.32/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.0-71-generic

答案1

terminal...

sudo apt-get update                          # update databases
sudo apt-get install linux-headers-generic   # install kernel headers

sudo dkms build virtualbox/5.0.32 -k "$(uname -r)/$(uname -p)"    # build VB kernel modules
sudo dkms install virtualbox/5.0.32 -k "$(uname -r)/$(uname -p)"  # install VB kernel modules
dkms status    # should show "virtualbox, 5.0.32: installed"
reboot

virtualbox...

install Virtualbox expansion pack
install guest-additions in guest VM

答案2

当面对问题时,

VBoxManage --version

打印输出:

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.

我尝试通过 GUI 打开 VirtualBox,它建议运行:

sudo modprobe vboxdrv

这对我来说很有效。

答案3

有完全相同的问题。

  1. 我关闭了联想 2019 笔记本电脑 BIOS 中的安全启动。
  2. 重新安装 VirtualBox。
  3. 在 Ubuntu 23.04 中完美运行的 VM。

相关内容