VirtualBox kernel modules do not match the version of VirtualBox

61,762

Solution 1

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

Solution 2

A less intrusive solution might be:

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

Source with more info.

Solution 3

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.

Solution 4

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.

Solution 5

This happened to me today on Debian 8 (Jessie) following a kernel patch. I fixed it as follows:

  1. su (I don't use sudo; if you do, then prepend sudo to the lines below)
  2. dpkg-reconfigure virtualbox-dkms
  3. dpkg-reconfigure virtualbox
  4. /etc/init.d/virtualbox restart

Thanks to Rikard/hg8 for the above tip on steps 2 and 3. In my case it's just possible they weren't needed, but felt good to do in any case.

Share:
61,762

Related videos on Youtube

Bharat Gaikwad
Author by

Bharat Gaikwad

Updated on September 18, 2022

Comments

  • Bharat Gaikwad
    Bharat Gaikwad over 1 year

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

    • Takkat
      Takkat over 11 years
      PLease clarify: for which version of virtualbox and how did you install the guest additions? Which version do you want to run (there is no 4.2.12)? DPKG tells us you have an old version 4.1.12 installed but 4.2.6 removed. How did you install virtualbox? Please also name tne architecture of the host (amd64 i386?).
  • Marco Faustinelli
    Marco Faustinelli over 7 years
    Thanks to this suggestion I was able to realize that I completely missed virtualbox-dkms. I stopped VBManager, installed virtualbox-dkms with apt-get, rebooted and things were in order.
  • aidan
    aidan over 7 years
    This worked for me (and I didn't have, or need to install, virtualbox-dkms)
  • Josh
    Josh over 7 years
    This fixed it for me in Ubuntu 16.04 after switching to the oracle PPAs. Thanks so much!
  • Everton P M A
    Everton P M A over 6 years
    Finally! Deleting the older .so file did the trick. I reinstalled from apt and everything seems to be working.
  • NuSkooler
    NuSkooler over 6 years
    After installing 5.2 from Oracle, I needed to run dpkg-reconfigure virtualbox-5.2 to fix this.
  • TommyDo
    TommyDo over 6 years
    I had same issue when move VB from 5.0 to 5.2. I followed your steps and it worked but in step 3, change virtualbox to virtualbox-5.2 if you have installed it.