38

I am trying to install virtualbox and make it work but it doesn't seem like I can. In the image you can see the output.

Command line output

If I run VBoxManage --version I get:

WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-dkms package and the appropriate
headers, most likely linux-headers-generic.

You will not be able to start VMs until this problem is fixed.
4.3.10_Ubuntur93012

But virtualbox-dkms is already installed and at the latest version. So I tried to reinstall it and i got this:

cli output 2

Any help will be appreciated.

EDIT:

The output after reconfigure (@M.Tarun suggestion):

cli output 3

EDIT 2:

Also installed the sources as @Hmayag instructed, purged virtualbox and installed it again but I got the same problem.

  • 1
    Kalispera Antoni. The installer is trying to build the kernel module but fails to locate the kernel source files. The clue is Module build for the currently running kernel was skipped since the kernel sources for this kernel does not seem to be installed. Check that you have those installed. Make sure they match the running kernel version. I think apt-get source linux-image-$(uname -r) should do it. – hmayag May 13 '14 at 20:25
  • Kalispera:). Unfortunately nothing happened. Please see my second edit. – Antonis Gr May 13 '14 at 20:37
  • Also installed dpkg-dev and ran the command again but no luck. – Antonis Gr May 13 '14 at 20:48
  • 2
    You probably have a mismatch between the running kernel and the installed header. Can you add the output of uname -a and dpkg -l | grep linux-headers? – Rmano May 13 '14 at 21:57
  • 1
    Upgrade to latest kernel. You seem to be running 3.11. – bain May 14 '14 at 0:11

10 Answers 10

56

Basically after you install those two packages you also need to do the reconfiguration:

sudo dpkg-reconfigure virtualbox-dkms
sudo dpkg-reconfigure virtualbox
sudo modprobe vboxdrv

And to fix eth0:

sudo modprobe vboxnetflt
  • please see the edit – Antonis Gr May 13 '14 at 20:21
  • works fine, thanks! Vagrant 1.7.2; VirtualBox 4.3.10; Ubuntu 14.04 – Makc Jun 2 '15 at 13:07
  • How above commands will deploy for centOS – HMS Sep 8 '15 at 7:19
  • 1
    If you still have problems make sure that UEFI secure boot is disabled. – totymedli Mar 1 '17 at 19:29
  • I had issues with virtualbox-dkms support after the kernel upgrade and ended up with installation of the latest version of VirtualBox from the official website site. – luart Oct 25 '17 at 13:29
14

I solved this problem by following commands:

sudo apt-get install linux-headers-generic
sudo dpkg-reconfigure virtualbox-dkms
  • Thanks this helped me on ubuntu 14.04 after a dist upgrade somehow linux headers changed – sandino Aug 24 '15 at 15:31
  • 3
    This helped me. I was able to fix with: sudo apt-get install linux-headers-`uname -r` and then sudo dpkg-reconfigure virtualbox-dkms. Thanks! – stitakis Jan 12 '17 at 20:48
  • @stitakis your comment should be an answer so I could upvote i properly – rioted Aug 21 '17 at 14:40
3

The reason for the problem is that you have booted the 3.11 kernel while the dpkg-reconfigure expects a 3.13 kernel. That's why you get the message 'no suitable module for the running kernel'.

Be sure to update your bootloader.

In my case the bootloader is updated from another OS (Debian) and booting to that and running sudo update-grub solved the problem.

2

I used the vendor’s official guide for Debian-based Linux distributions:

printf 'deb http://download.virtualbox.org/virtualbox/debian %s contrib\n' "$(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/virtualbox.list

wget -qO- https://www.virtualbox.org/download/oracle_vbox{,_2016}.asc | sudo apt-key add -

sudo apt-get purge virtualbox
sudo apt-get update
sudo apt-get install virtualbox-5.0 dkms
1

I wasn't able to fix the problem with any other solution suggested, so I made a fresh 14.04 installation and everything is fine now.

1

In my case, the issue was having virtualbox-4.1 installed alongside virtualbox-4.2. Once I uninstalled 4.1, I could run sudo /etc/init.d/vboxdrv setup and sudo modprobe vboxdrv just fine, as well as start VMs.

1

You have to check the version of gcc your are using. I was facing the same problem of virtualbox kernel compilation. I fixed the issue using this post https://www.virtualbox.org/ticket/12467

You probably are using a outdated version of gcc that is different of the gcc used by the Linux kernel.

Check the default version your are using :

gcc -v

Mine is gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-8ubuntu1)

And the gcc version your kernel was compiled with

dmesg | more
[    0.000000] Linux version 3.13.0-83-generic (buildd@lgw01-55) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 (Ubuntu 3.13.0-83.127-generic 3.13.11-ckt35)

or with

dpkg -l gcc

If the gcc versions are different like on my system, switch your default gcc compiler

sudo update-alternatives --config gcc

then virtualbox-dkms installation should works fine

sudo apt-get --reinstall install virtualbox-dkms
0

The clue is here: Please install the virtualbox-dkms package and the appropriate headers, most likely linux-headers-generic.

Since you have the first, it must still want the second.

sudo apt-get install linux-headers-generic

Then make sure everything is up to date.

sudo apt-get update

sudo apt-get upgrade

  • 2
    Sorry just forgot to write that I have them too. linux-headers-generic is already the newest version. is the output when i try to install them. – Antonis Gr May 13 '14 at 20:11
  • 2
    Thank you, I added that information to your question to insure that you get accurate answers – Elder Geek May 13 '14 at 20:15
0

I had the same issue. I found that the source of the problem is most probably that I'm using a custom kernel.

Downloading the latest .deb package from virtualbox.org, and installing it by dpkg -i has solved the problem in my case.

-1

Try

sudo /etc/init.d/vboxdrv setup

protected by Community Oct 23 '17 at 9:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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