[关闭]
@zifehng 2018-04-06T19:12:36.000000Z 字数 1973 阅读 1949

VirtualBox报错“kernel driver not installed(rc=-1908)”

Ubuntu VirtualBox


软件环境:
  Ubuntu16.04
  VirtualBox5.1.34

安装VirtualBox在打开虚拟机时出现如下错误提示:
vboxdrv_error
先按照提示用root权限执行modprobe vboxdrv重新加载模块,却又提示无法找到vboxdrv模块,
于是尝试重新安装软件包virtualbox-dkms:

  1. $ sudo apt install --reinstall virtualbox-dkms
  2. ...
  3. Error! Bad return status for module build on kernel: 4.13.0-38-generic (x86_64)
  4. Consult /var/lib/dkms/virtualbox/5.1.34/build/make.log for more information.
  5. ...

软件包安装失败,打开make.log,查看更详细的错误信息:

  1. DKMS make.log for virtualbox-5.1.34 for kernel 4.13.0-38-generic (x86_64)
  2. Fri Apr 6 12:53:19 CST 2018
  3. make: Entering directory '/usr/src/linux-headers-4.13.0-38-generic'
  4. AR /var/lib/dkms/virtualbox/5.1.34/build/built-in.o
  5. AR /var/lib/dkms/virtualbox/5.1.34/build/vboxdrv/built-in.o
  6. CC [M] /var/lib/dkms/virtualbox/5.1.34/build/vboxdrv/linux/SUPDrv-linux.o
  7. gcc: error: unrecognized command line option ‘-fstack-protector-strong
  8. scripts/Makefile.build:308: recipe for target '/var/lib/dkms/virtualbox/5.1.34/build/vboxdrv/linux/SUPDrv-linux.o' failed
  9. make[2]: *** [/var/lib/dkms/virtualbox/5.1.34/build/vboxdrv/linux/SUPDrv-linux.o] Error 1
  10. scripts/Makefile.build:581: recipe for target '/var/lib/dkms/virtualbox/5.1.34/build/vboxdrv' failed
  11. make[1]: *** [/var/lib/dkms/virtualbox/5.1.34/build/vboxdrv] Error 2
  12. Makefile:1550: recipe for target '_module_/var/lib/dkms/virtualbox/5.1.34/build' failed
  13. make: *** [_module_/var/lib/dkms/virtualbox/5.1.34/build] Error 2
  14. make: Leaving directory '/usr/src/linux-headers-4.13.0-38-generic'

原来是编译工具gcc出现了问题,联想到之前为了编译Android5.1代码,降级安装了gcc-4.8,而Ubuntu16.04自带的版本为gcc-5,很有可能这就是原因所在,于是尝试恢复gcc-5版本:

  1. $ sudo update-alternatives --install gcc /usr/bin/gcc /usr/bin/gcc-5 90
  2. $ sudo update-alternatives --install g++ /usr/bin/gcc /usr/bin/g++-5 90
  3. $ sudo update-alternatives --install gcc /usr/bin/gcc /usr/bin/gcc-4.8 100
  4. $ sudo update-alternatives --install g++ /usr/bin/gcc /usr/bin/g++-4.8 100
  1. $ sudo update-alternatives --config gcc
  2. $ sudo update-alternatives --config g++

再次执行:

  1. $ sudo apt install --reinstall virtualbox-dkms
  2. $ sudo modprobe vboxdrv

然后打开VirtualBox加载虚拟机,顺利解决!

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注