VirtualBox error reporting "kernel driver not installed(rc=-1908)"

Keywords: VirtualBox sudo Linux Makefile

Software environment:

When installing VirtualBox, the following error prompts appear when opening the virtual machine:

Firstly, the modprobe VBox DRV reload module was executed with root privilege according to the prompt, but the VBox DRV module could not be found.
So try to reinstall the package virtualbox-dkms:

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

The package installation failed. Open make.log to see more detailed error information:

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

The original compilation tool GCC had a problem, associating with the previous downgraded installation of gcc-4.8 in order to compile Android 5.1 code, and the version of Ubuntu 16.04 is gcc-5, which is probably the reason. So I tried to restore the version of gcc-5:

  • Configure the priority of two versions of gcc/g++ (4.8, 5), because the priority of version 4.8 is higher than that of normal compilation requirements:
$ sudo update-alternatives --install gcc /usr/bin/gcc /usr/bin/gcc-5 90
$ sudo update-alternatives --install g++ /usr/bin/gcc /usr/bin/g++-5 90
$ sudo update-alternatives --install gcc /usr/bin/gcc /usr/bin/gcc-4.8 100
$ sudo update-alternatives --install g++ /usr/bin/gcc /usr/bin/g++-4.8 100
  • Manually select gcc/g++ version 5.0:
$ sudo update-alternatives --config gcc
$ sudo update-alternatives --config g++


$ sudo apt install --reinstall virtualbox-dkms
$ sudo modprobe vboxdrv

Then open VirtualBox to load the virtual machine, and solve it smoothly! ___________

Posted by amar3d on Tue, 05 Feb 2019 16:45:16 -0800