VirtualBox kernel modules do not match the version of VirtualBox

The VirtualBox 4.2.12 on Ubuntu 12.04 was running fine till I needed to install guest additon. After its installation:

 Failed to open a session for the VM Win 7 exit code 1;

 RTR3Init failed with rc=-1912(rc=1912)

After running dpkg --list | grep virtualbox:

ii  virtualbox                             4.1.12-dfsg-2ubuntu0.2                  x86 virtualization solution - base binaries
rc  virtualbox-4.2                         4.2.6-82870~Ubuntu~precise              Oracle VM VirtualBox
ii  virtualbox-dkms                        4.1.12-dfsg-2ubuntu0.2                  x86 virtualization solution - kernel module sources for dkms
ii  virtualbox-guest-additions             4.1.12-1                                transitional package for virtualbox-guest-additions-iso
ii  virtualbox-guest-additions-iso         4.1.12-1                                guest additions iso image for VirtualBox
ii  virtualbox-qt                          4.1.12-dfsg-2ubuntu0.2                  x86 virtualization solution - Qt based user interface

Any help is appreciated...

Thanks...


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.


In my case the virtualbox-dkms version simply mismatched the remaining packages:

$ dpkg --list | grep virtualbox
ii  unity-scope-virtualbox                        0.1+13.10.20130723-0ubuntu1 all                         VirtualBox scope for Unity
ii  virtualbox                                    5.1.34-dfsg-0ubuntu1.16.04. amd64                       x86 virtualization solution - base binaries
ii  virtualbox-dkms                               5.0.40-dfsg-0ubuntu1.16.04. all                         x86 virtualization solution - kernel module sources for dkms
ii  virtualbox-ext-pack                           5.1.34-0ubuntu1.16.04.2     all                         extra capabilities for VirtualBox, downloader.
ii  virtualbox-qt                                 5.1.34-dfsg-0ubuntu1.16.04. amd64                       x86 virtualization solution - Qt based user interface

I simply reinstalled it:

$ sudo apt purge virtualbox-dkms
$ sudo apt install virtualbox-dkms
$ dpkg --list | grep virtualbox
ii  unity-scope-virtualbox                        0.1+13.10.20130723-0ubuntu1 all                         VirtualBox scope for Unity
ii  virtualbox                                    5.1.34-dfsg-0ubuntu1.16.04. amd64                       x86 virtualization solution - base binaries
ii  virtualbox-dkms                               5.1.34-dfsg-0ubuntu1.16.04. all                         x86 virtualization solution - kernel module sources for dkms
ii  virtualbox-ext-pack                           5.1.34-0ubuntu1.16.04.2     all                         extra capabilities for VirtualBox, downloader.
ii  virtualbox-qt                                 5.1.34-dfsg-0ubuntu1.16.04. amd64                       x86 virtualization solution - Qt based user interface
ii  virtualbox-source                             5.1.34-dfsg-0ubuntu1.16.04. all                         x86 virtualization solution - kernel module source

and the VM started without errors.