46

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.

11 Answers11

70

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
Eric Carvalho
  • 55,453
M.Tarun
  • 5,121
17

I solved this problem by following commands:

sudo apt-get install linux-headers-generic
sudo dpkg-reconfigure virtualbox-dkms
amc
  • 7,292
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.

Zanna
  • 72,312
Pit
  • 31
2

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.

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
David Foerster
  • 36,890
  • 56
  • 97
  • 151
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

I had the same error on ubuntu 19.04 disco. I could solve it by disabling secure boot (via BIOS).

Melebius
  • 11,750
Cie6ohpa
  • 166
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

Elder Geek
  • 36,752
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