Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

After upgrading from 11.10 to 12.04, virtual box stopped working.

I've run the following to try to fix it:

sudo aptitude update
sudo aptitude install dkms
sudo /etc/init.d/vboxdrv setup

but when i run the last command I get:

bash: /etc/init.d/vboxdrv: No such file or directory

When I try

sudo /etc/init.d/virtualbox start

I get:

 * Starting VirtualBox kernel modules
 * No suitable module for running kernel found

I've also tried:

sudo dkms install virtualbox/4.1.2

and got:

Error! Could not find module source directory.
Directory: /usr/src/virtualbox-4.1.2 does not exist.

Edit:

I've also tried installing linux headers:

sudo apt-get install linux-headers-$(uname -r)

but they were already installed.

From what I've read re-installing may not fix the problem. Is there a way I can fix virtual box?

Edit: reinstalling virtualbox fixed the problem

Thanks.

share|improve this question
lacking the 10 reputation to place an answer ... but shorthand is: ´apt-get install --reinstall virtualbox-dkms´ - one just needs to have build-essential and linux-headers installed previously. – syslogic Feb 3 at 18:17

5 Answers

I had a similar problem. Here is what worked for me:

This may be required if you get a kernel sources not found type of error:

sudo apt-get install build-essential linux-headers-`uname -r`

Then reconfigure the relevant packages to kick them in to rebuilding.

sudo dpkg-reconfigure virtualbox-dkms 
sudo dpkg-reconfigure virtualbox
share|improve this answer
That worked for me (with the modprobe as in GTO69's answer) – Matthieu Jul 10 '12 at 17:24
1  
apt-get install build-essential linux-headers`uname -r` may also be needed, as a note. – Mochan Feb 17 at 6:37
I am getting sudo dpkg-reconfigure virtualbox-dkms dpkg-query: package 'virtualbox-dkms' is not installed and no information is available when I try sudo dpkg-reconfigure virtualbox-dkms. I don't have this error after reinstalling virtualbox... – pinouchon Mar 5 at 10:20
up vote 9 down vote accepted

I ended up uninstalling and reinstalling virtualbox using apt-get. It saw that there were kernel parts missing and installed them.

sudo apt-get remove virtualbox
sudo apt-get install virtualbox
share|improve this answer
Note that "sudo apt-get install virtualbox --reinstall" does not kick off the module build process. – Ben Simpson May 9 '12 at 18:26

This worked for me too:

sudo apt-get remove virtualbox
sudo apt-get install virtualbox

However, I had to add:

sudo modprobe vboxdrv
share|improve this answer

You are using the wrong version for building the dkms. Try this:

sudo dkms install virtualbox/4.1.12

It appears to have worked for me. This is after you install the virtualbox-dkms package of course.

share|improve this answer

This answer is based on @curtis's answer, apparenly the answer's version specific

You are using the wrong version for building the dkms. Try this:

sudo dkms install virtualbox/4.1.12

It appears to have worked for me. This is after you install the virtualbox-dkms package of course.

the version can be changed (in bold given in the quotation).

So try:

ls -d /usr/src/virtualbox*

which will give you something like

/usr/src/virtualbox-version

now take version and use it in the command above like

sudo dkms install virtualbox/version

If that is not giving you

Module virtualbox/version already installed on kernel kernelVersion-generic/architecture

run this following commands after that(taken from other answers on the post)

  • rebuilding just the kernel modules

    sudo dpkg-reconfigure virtualbox-dkms

  • reinstalling

    sudo apt-get remove virtualbox && sudo apt-get install virtualbox

and if required, load the module sudo modprobe vboxdrv

if DKMS is showing error that some kernel is missing, then just install the kernel and then rebuild/reinstall virtualbox.

EDIT: apparently this is also exist on 12.10

share|improve this answer

protected by Community May 21 '12 at 16:43

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.