31

I am getting the following error when attempting to install the VirtualBox kernel modules :

------------------------------
Deleting module version: 4.1.18
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-4.1.18 DKMS files...
Building only for 3.5.0-17-generic
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

I have tried installing the linux-source package, but I am not sure how Ubuntu handles kernel sources and headers.

Any ideas on how to do this from an Ubuntu standpoint?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83

7 Answers7

20

My Virtual Box told me that the kernel drivers were not installed. I ran

sudo apt-get remove virtualbox-dkms   

to remove the drivers and then re-installed them

sudo apt-get install virtualbox-dkms 

which rebuilt the drivers and I was able to run virtualbox with no problems

abu_bua
  • 10,783
Kevin
  • 201
12

An other way:

apt-get install linux-headers-`uname -r`
dpkg-reconfigure virtualbox-dkms

The normal way:

/etc/init.d/vboxdrv setup
Marc Quinton
  • 137
  • 1
  • 3
  • 1
    Wonder why “an other way” is mentioned before the “normal” one. However, dpkg-reconfigure seems to be the right option. – Melebius Oct 05 '16 at 12:17
  • 1
    To add to this, I found the following sequence worked when I unpgraded to 16.04: sudo apt-get install linux-headers-`uname -r` then sudo dpkg-reconfigure virtualbox-dkms and finally sudo dpkg-reconfigure virtualbox – Dave Feb 20 '17 at 13:48
  • This will put you in the OPs situation (again) each kernel update. – earthmeLon Mar 22 '19 at 01:51
  • This script does not even exist with Ubuntu 18.04. Does not seem the normal way indeed... – MappaM Sep 25 '20 at 09:16
5

You need the kernel header as well. Based on your output, sudo apt-get install kernel-headers-3.5.0-17-generic should do it. On the guest VM, either autorun the ISO image or sudo sh ./VBoxLinuxAdditions.run from the shell prompt should work. Appears this is a known problem with the latest 12.10 release.

Zanna
  • 70,465
3

This is caused by the kernel headers not being available. These headers are not typically required, but help other applications need them to build kernel modules to keep in sync with your distribution and the version you are using.

You can install specific headers, or you can install 'generic', or 'current':

sudo apt install linux-headers-generic

This will ensure that when you take in new kernels, the headers of those kernels are also installed. When you update your kernel, VirtualBox will be able to update itself with the newest, matching headers. Sometimes these can be found by other names, such as linux-headers-amd64, in other distributions.

After you have the headers, you can purge/re-install VirtualBox, or have VirtualBox rebuild the modules and complete the setup:

sudo dpkg-reconfigure virtualbox-dkms  
sudo modprobe vboxdrv
earthmeLon
  • 11,247
2

It didn't work for me. I solved it by running:

pkexec synaptic

Search for 'dkms' and (re)install the one for VirtualBox and press the 'Apply' button. The output should say that the VirtualBox kernel drivers are up and running.

karel
  • 114,770
1

What worked for me: To run vboxconfig to rebuild virtualbox kernel drivers sudo /sbin/vboxconfig

0

Okay...so I had this problem. I tried an amazing array of different things to solve the problem. What worked for me was turning off Bios Security. The app was installed properly...There is probably a way to secure the BIOS and run VirtualBox...but I do not know how.

Nom Ox
  • 1