VirtualBox error after installing Linux Kernel 4.4.4 in Ubuntu

Today, I upgraded my Ubuntu 14.04 LTS system to Linux Kernel 4.4.4. Upgrade process went without any errors so far. However, Oracle VirtualBox didn’t work after upgrading to Kernel 4.4.4.

Whenever I started a new virtual machine, it showed the following error and didn’t let the guest machine to start.

Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

'/sbin/rcvboxdrv setup'

as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

Where: sublibOsInit what:3
VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support
driver is not installed, On linux, open returned ENOENT.

VirtualBox - Error In suplibOsInit_001

As you can see in the above screenshot, the error wizard says that you can fix the problem by running the command:

$ sudo /sbin/rcvboxdrv setup

But it didn’t help either. I got the following error after I ran the above command:

Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modulesError! Could not locate dkms.conf file.
File:  does not exist.
 ...done.
Trying to register the VirtualBox kernel modules using DKMSError! DKMS tree already contains: vboxhost-5.0.16
You cannot add the same module/version combo more than once.
 ...failed!
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...failed!
  (Look at /var/log/vbox-install.log to find out what went wrong)

sk@sk: ~_002

I don’t want to switch back to old Kernel. After a bit of google search, I got the solution from askubuntu forums.

I followed the exact steps, and It worked well as I expected.

Here is what I did to solve the above error.

Add the following repository:

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Update the sources list and install gcc/g++:

$ sudo apt-get update
$ sudo apt-get install gcc-5 g++-5

We have installed GCC. Now, run the following command to show the installed versions.

$ ls -lh /usr/bin/gcc* 

Sample output:

lrwxrwxrwx 1 root root 7 Apr 8 2014 /usr/bin/gcc -> gcc-4.8
-rwxr-xr-x 1 root root 758K Jan 27 13:10 /usr/bin/gcc-4.8
-rwxr-xr-x 1 root root 858K Dec 6 04:31 /usr/bin/gcc-5
lrwxrwxrwx 1 root root 10 Apr 8 2014 /usr/bin/gcc-ar -> gcc-ar-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-ar-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-ar-5
lrwxrwxrwx 1 root root 10 Apr 8 2014 /usr/bin/gcc-nm -> gcc-nm-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-nm-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-nm-5
lrwxrwxrwx 1 root root 14 Apr 8 2014 /usr/bin/gcc-ranlib -> gcc-ranlib-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-ranlib-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-ranlib-5

As you see in the above output, my machine has gcc-4.8 and gcc-5 versions.

Then, update alternatives using the following commands:

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20 --slave /usr/bin/g++ g++ /usr/bin/g++-5

You must make add your own alternatives.

Finally, select which alternative gcc to use as shown below.

$ sudo update-alternatives --config gcc

Sample output:

Type the selection. Here I choose gcc-5, so I entered number 2.

There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-4.8 40 auto mode
 1 /usr/bin/gcc-4.8 40 manual mode
 2 /usr/bin/gcc-5 20 manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gcc-5 to provide /usr/bin/gcc (gcc) in manual mode

That’s it.

Now, try to recompile the VirtualBox Kernel modules with command:

$ sudo /usr/lib/virtualbox/vboxdrv.sh setup

Sample output:

Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modulesError! Could not locate dkms.conf file.
File: does not exist.
 ...done.
Trying to register the VirtualBox kernel modules using DKMSError! DKMS tree already contains: vboxhost-5.0.16
You cannot add the same module/version combo more than once.
 ...failed!
 (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...done.
Starting VirtualBox kernel modules ...done.

Voila! This time it worked.

Now, I can start the guest machines without any issues.

Any problem while updating Oracle VirtualBox extension pack? Here is the solution.

That’s all for now. I will be here again with an interesting article soon. Until then, stay tuned with OSTechNix.

If you find this tutorial useful, please share it on your social networks and support us.

Thanks for reading! Cheers!!

  • Jorge Rocha

    I just changed my laptop to a new one, Skylake based, and I really need the kernel 4.4.4. I was having the same problem updating virtualbox, but it was easy with these instructions. Thanks!

    • SK

      I am so glad I helped you. Cheers.

  • Dipto Pratyaksa

    Thanks for this, I spent my whole night trying to fix VirtualBox on Kernel 4.5. Will it also work for Kernel 4.5 as well?

    • SK

      I didn’t check it on Kernel 4.5. Please try it and let me know if it works. I will update this tutorial.