34

Running the sudo sh vboxsign.sh and getting "FATAL: Module vboxdrv not found in directory /lib/modules/4.10.0-20-generic"

What am I missing? This ran fine last time, but I've since upgraded, and must have forgotten something. I set working directory correctly.

6 Answers 6

34

Try do reinstall "virtualbox-dkms"

sudo apt install --reinstall virtualbox-dkms
6
  • 2
    Worked! For edification, will you explain why that likely fixed the problem?
    – Tom Mercer
    May 8, 2017 at 1:57
  • 2
    I get: E: Unable to locate package virtualbox-dkms. I have added virtualbox to my sources list, any ideas why this is? Feb 28, 2019 at 13:02
  • When I try this, I get Error! Bad return status for module build on kernel Jan 11, 2021 at 0:16
  • It did not work for me. I had to download again the package from virtualbox.org/wiki/Linux_Downloads and install it with sudo dpkg -i virtualbox-6.1_6.1.16-140961_Ubuntu_eoan_amd64.deb. I have Ubuntu 20.04.1 LTS Jan 11, 2021 at 10:35
  • It worked for me. At first I retrieve errors because Virtualbox was running. After closing it, it worked perfectly and my VMs are running again. Sep 28, 2021 at 9:00
12

For me, reinstalling virtualbox-dkms always gave an error. It was my first time upgrading the kernel, and hadn't upgraded the headers. I needed to also do

sudo aptitude install linux-headers-`uname -r`

and not accept it's first solution (which was to actually do nothing), but accept the second solution which was to upgrade some further library. After that, then

sudo apt install --reinstall virtualbox-dkms

worked for me.

2
  • 1
    Same, except using apt instead of aptitude for the first command was enough.
    – KaKi87
    Sep 3, 2022 at 21:34
  • Showing error aptitude: command not found Jan 11 at 6:59
4

Based on other answers and the Virtualbox official documentation, here is something that worked:

sudo apt-get install build-essential linux-headers-`uname -r`
sudo apt-get install autoconf automake bc bison build-essential flex gcc g++ make python -y
sudo apt-get purge virtualbox

sudo sh -c 'echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -c | cut -f2) non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install virtualbox-6.0
1

Reinstallation as mentioned above - had not helped me (within (X)Ubuntu 18.04, with the recently updated kernel). What worked in my case:

  1. Setup key with:

    wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc | sudo apt-key add -
    
  2. Setup repository with:

    sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian cosmic non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
    
  3. Download and install the latest version of VirtualBox (with all the extra packages) from this link.

1
  • That's just not how you do it. Setting up repository only to download packages manually is somewhat pointless. Jan 19, 2022 at 5:19
0

i had the same problem after updating Kernel to 5.4.0-37 and i faced some problems worth mentioning:

turns out you can't install Guest additions using old versions of Virtual-box (i guess any version before 5.2) while using this new kernel and Virtualbox-dkms is not supported anymore. the only way to solve the problem is to remove old version and install Virtual-box 6 from Oracle but this code:sudo apt-get purge virtualbox leaves some stuff behind.

after using purge to remove Virtualbox, search "virtualbox" in system directory (/) and manually remove everything then install Virtualbox 6 and Guest addition.

that worked for me.

0

I seem to have this issue with VirtualBox every time I upgrade my kernel.

To fix it do :

sudo apt update
sudo apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms

The module will then load successfully.

sudo modprobe vboxdrv

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .