4

I've already installed and used virtualbox properly. However, since yesterday I'm getting this error when starting 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

I also followed the answer of this question but nothing changed. after running sudo apt-get --reinstall install virtualbox-dkms I'm getting the following output:

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'.

Well, maybe someone has anonther idea?

Edit: Output of uname -r is 4.4.0-66-generic. dkms status is virtualbox, 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 is disabled

Output of 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
Organic Marble
  • 23,641
  • 15
  • 70
  • 122
tux
  • 63
  • 1
    What changed on your system before this started happening? – Organic Marble Mar 18 '17 at 00:46
  • It is not a good idea to run virtualbox as root. – Takkat Mar 18 '17 at 06:48
  • I haven't noticed any changes on my system. I really don't know. I've installed two VM's and run them successfully. I've installed via virtualbox and Ubuntu VM but I couldn't run it and got this error: Kernel driver not installed (rc=-1908) @Takkat: Why is running virutalbox as root not a good idea? – tux Mar 18 '17 at 12:02
  • Edit your question to include the terminal output of uname -r, dkms status, and dpkg -l *virtualbox* | grep ii. Lastly, is secure boot enabled or disabled in your BIOS? – heynnema Mar 18 '17 at 15:30
  • @heynnema, I've edited my question and added the output you asked me for. Do you have any further suggestions? – tux Mar 28 '17 at 22:44
  • @tux see my answer. – heynnema Mar 28 '17 at 23:39

3 Answers3

2

In 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

In virtualbox...

install Virtualbox expansion pack
install guest-additions in guest VM
heynnema
  • 70,711
  • dkms build and dkms install results `Kernel preparation unnecessary for this kernel. Skipping...

    Building module: cleaning build area.... make KERNELRELEASE=4.4.0-71-generic -C /lib/modules/4.4.0-71-generic/build M=/var/lib/dkms/virtualbox/5.0.32/build....(bad exit status: 2) 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.` So that's not the solution :-\

    – tux Apr 02 '17 at 19:32
  • @tux well it should be the solution, except for the fact that it's crashing in the build process. This problem is why you can't run VB. Some of the installation has failed. In terminal do cat /var/lib/dkms/virtualbox/5.0.32/build/make.log and paste that output into an edit of your original question (not into the comments please). – heynnema Apr 02 '17 at 22:03
  • @tux ps: can you please post an English translation of the output of your command sudo apt-get --reinstall install virtualbox-dkms? – heynnema Apr 02 '17 at 22:09
  • This worked for me for me on Ubuntu 17.04 (and the 5.1.22 virtualbox version) – Billal Begueradj Dec 13 '17 at 09:10
  • In my case it was this line I overlooked: Module build for kernel 4.14.0-3-amd64 was skipped since the kernel headers for this kernel does not seem to be installed. So after installing them like in your answer it was enough to reconfigure virtualbox using sudo dpkg-reconfigure virtualbox-dkms instead of calling dkms make manually. Also sudo service virtualbox start might be necessary. Imo this is a bug and the linux-headers should be a dependency of the virtualbox-dkms package. – mxmlnkn Jan 22 '18 at 19:24
0

When facing the problem,

VBoxManage --version

printed the output:

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.

I tried to open VirtualBox through GUI and it suggested to run:

sudo modprobe vboxdrv

That did the trick for me.

rtrigo
  • 101
0

Having exactly the same issue.

  1. I TURNED OFF Secure Boot in my Lenovo 2019 laptop BIOS.
  2. Re-installed VirtualBox.
  3. Perfectly working VM in Ubuntu 23.04.
sotirov
  • 3,169
Vert
  • 13