How to fix 'modprobe vboxdrv' error in virtualBox?

As the first step run this command:

sudo modprobe vboxdrv

If it's not helpful run these commands:

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

Then reboot your system and after reboot run this command:

sudo modprobe vboxdrv

And if it doesn't work you must disable Secure Boot in your BIOS/UEFI settings because Secure Boot prevents unsigned modules from being loaded.


  1. Uninstall virtualbox-dkms and its configurations by running the below commands:

    sudo apt-get remove virtualbox-dkms
    sudo apt-get remove --purge virtualbox-dkms
    
  2. Install Linux headers and Linux image by running the below command:

    sudo apt-get install -y linux-headers-amd64 linux-image-amd64
    
  3. Install virtualbox-dkms

    sudo apt-get install -y virtualbox-dkms
    

In my case it has to do with UEFI being active. In that case, unsigned kernel modules like vboxdrv aren't loaded.

More info here: Could not load 'vboxdrv' after upgrade to Ubuntu 16.04 (and I want to keep secure boot)