32

I have installed virtual box in my device using sudo apt install virtualbox-qt command.

But when I run virtualbox command or virtualbox --version command it gives me this error:

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 searched a solution from the internet but it didn't work for me. How should I solve this?

update

when I run sudo dpkg-reconfigure virtualbox-dkms U receive this error: error

peterh
  • 11,875
  • 18
  • 85
  • 108
Asha
  • 805
  • 3
  • 10
  • 18

3 Answers3

44

It clearly states that you need to install the virtualbox-dkms packages. You can follow these steps to solve the problem.

  • Install the virtualbox-dkms
sudo apt-get install virtualbox-dkms
  • Once you install those packages you also need to do the reconfiguration:
sudo dpkg-reconfigure virtualbox-dkms
sudo dpkg-reconfigure virtualbox
  • If your problem is still not fixed try installing the headers:
sudo apt-get install linux-headers-generic

You can refer to this Virtualbox Wiki if any of the above won't work. Also, you may want to check this similar problem on Ubuntu 14.04

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Billion Shiferaw
  • 835
  • 10
  • 17
  • 2
    Thank you for your answer, when i run `sudo dpkg-reconfigure virtualbox-dkms ` i received an error. i updated the screenshot above. kindly request you to check it – Asha Feb 22 '20 at 09:40
  • This was helpful. In my case I had to update my gcc before running these commands. @F.A.SULAIMAN this might be your issue as well. – Abdelrahman Shoman Jun 25 '20 at 14:21
  • 1
    the reconfiguration failed with the above screenshot – caduceus Aug 21 '20 at 08:28
  • I went for KVM2, easy to install and working like a charm : https://minikube.sigs.k8s.io/docs/drivers/kvm2/ – Rafiq Apr 02 '21 at 15:32
  • `sudo dpkg-reconfigure virtualbox` might return the error `invoke-rc.d: policy-rc.d denied execution of restart.` it can be fixed thanks to the following answer here: https://stackoverflow.com/questions/46247032/how-to-solve-invoke-rc-d-policy-rc-d-denied-execution-of-start-when-building the command used there could not run even with `sudo`, I had to be root (`sudo su`) to run it. my system is ubuntu focal – mdnfiras Aug 12 '21 at 22:48
11

Try this:

apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
Andres Diaz
  • 111
  • 1
  • 2
  • 2
    How do you know if it will locate the package? Any chance that you know if a package is available for windows ubuntu subsystem aka. 4.4.0-19041-Microsoft ? – serup Sep 29 '20 at 19:21
9

The only thing that helped in my case was disabling the Ubuntu Secure Boot

I will quote an answer from Askubuntu:"You might have a kernel version greater than 4.4.0-20 which enforces that unsigned kernel modules are not to be allowed to run with Secure Boot enabled in BIOS"

Link to the Answer: https://askubuntu.com/questions/777308/virtualbox-problem-kernel-module-is-not-loaded"

Link how to disable Secure Boot: http://itadminguide.com/disable-secure-boot-in-ubuntu/

After this you will most likely have another error but with Minikube, and to fix you'll have to Enable enable Virtualization in Bios

link: https://github.com/kubernetes/minikube/issues/5456

maleckicoa
  • 481
  • 5
  • 8