VirtualBox kernel modules do not match the version of VirtualBox

You seem to have two separate versions of VirtualBox installed!

I would recommend that you fully uninstall all versions of VirtualBox:

sudo apt-get autoremove 'virtualbox*'

Then reinstall directly from Oracle. Go to the VB download page, scroll down to "Debian-based Linux distributions", and follow the instructions.

Then try again.

By the way, you don't need to use grep with dpkg. Here is a nicer alternative to your command:

dpkg --list 'virtualbox*'

A less intrusive solution might be:

sudo dpkg-reconfigure virtualbox-dkms
sudo dpkg-reconfigure virtualbox

Source with more info.


I had this problem after switching from ubuntu repo version to ppa version. The root cause of the problem was exactly as stated in the error message: kernel module version mismatch. I have confirmed this with

modinfo vboxdrv

which came back as version 5.0. (From ppa, I have vbox 5.1).

I have uninstalled virtualbox-dkms, because installing it would also install the regular vbox version from ubuntu repo. But the kernel modules were still among the modules which are handled by DKMS (/lib/modules/(kernelversion)-generic/updates/dkms/), so I am GUESSING that is why the scripts would not work:

I have tried

sudo /sbin/vboxconfig

which seemingly did everything as usual, stopping kernel modules, recompiling, reloading the (supposedly) new kernel modules. Except checking the module version still came up 5.0.

Then I tried

sudo /sbin/rcvboxdrv setup

with the same result: no version change.

Then I decided to delete the modules because I did not like the fact that they were in the dkms folder. To do that, you need to unload the kernel modules with

sudo rmmod vboxnetadp vboxnetflt vboxpci vboxdrv

then delete the module files from /lib/modules/(kernelversion)-generic/updates/dkms . Then run

sudo /sbin/rcvboxdrv setup

again, and voilá the new modules are v5.1, and not under dkms anymore, my VMs are running.

Now that I think of it, maybe the modules were correctly recompiled in /lib/modules/4.4.0-59-generic/misc/, but at loading the dkms modules might have priority. Unfortunately I have no more time to investigate this.

ps.: If you make this same transition from repo version to ppa, make sure to add yourself to the (newly created) group vboxusers, and then log out and back.