Virtualbox

how do I resolve ‘The character device /dev/vboxdrv does not exist’ error in Ubuntu 18.04 or Linux 6.18.5+kali-amd64 

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

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