MacOS High Sierra 10.13 introduced the User-Approved Kernel Extension Loading feature back in 2017. On all macOS versions since, you must manually approve kernel extensions before they can load.
If you attempt to load the kernel extension (KEXT) without approval, you’ll encounter the VirtualBox Kernel Driver Not Installed error message.
While this usually happens during the first launch after installation, the error can also occur at later points due to unsigned modules and similar issues. The same is true for Linux systems as well.
Table of Contents
What’s Causing the VirtualBox Kernel Driver Not Installed Error?
- Unregistered Vbox kext
- Kernel module signature issues
- Problems with kext cache
- Misconfigured kext management flag
- Kernel module and GCC version mismatch
How to Fix This Error on Mac?
First of all, please note that VirtualBox only works on Intel Macs as it isn’t yet ported to M1 macs. Another thing worth mentioning is that numerous users were able to resolve this error by switching to a different version of VirtualBox and installing the extension packs.
As such, before you start troubleshooting, we recommend either using the latest VirtualBox version or reverting to an older stable build, as that could easily fix the error.
Allow Module to Load
In most cases, allowing the kernel module to load is all that’s needed to fix this error. Here are the necessary steps for this:
- Click on the Apple Menu and go to System Preferences > Security & Privacy.
- Press the Allow button towards the bottom.
- The issue should be resolved now. But do keep in mind that the allow option is only available for 30 mins after making the load request. You’ll need to try to load the module again to make it reappear.
If the GUI method isn’t working, enter the following command into the terminal to restart the startup service for loading the kernel module and try once more:sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart
Additionally, you can also try registering the VirtualBox kernel extension directly via the terminal, as this fixed this error for some users. Here is the necessary command for this:sudo kmutil load -p '/Library/Application Support/VirtualBox/VBoxDrv.kext'
As before, allow the kernel to load via System Preferences and reboot, then check if VirtualBox works. If the error still persists, you can instead try adding Oracle’s developer ID to the security assessment policy. You’re basically approving that the kernel extension can load but via the terminal this time.
- First, enter the following command in the terminal:
spctl kext-consent add VB5E2TV963
- If that doesn’t help, restart your Mac and hold Command + R to boot into recovery mode.
- Select Utilities > Terminal and enter the command from Step 1 again.
Clean Reinstall VirtualBox
As stated, reinstalling VirtualBox has been an effective fix for numerous users. Here are the steps for a clean reinstall:
- Open the VirtualBox installation file and click on
VirtualBox_uninstall.tool
. - Enter Yes to confirm that you want to uninstall VirtualBox and all its packages.
- Afterward, restart your Mac and download the latest VirtualBox version. In my case, the file name is
VirtualBox-6.1.36-152435-OSX.dmg
. - Execute the following commands in the terminal to install VirtualBox:
sudo hdiutil attach VirtualBox-6.1.36-152435-OSX.dmg
cd /Volumes/VirtualBox
sudo installer -package VirtualBox.pkg -target /
Disable Secure Boot
Secure Boot is known to sometimes interfere with trusted programs due to problems with the digital signature. You can try briefly disabling this to ensure it’s not causing the error. Here are the steps to do so:
- Hold Command + R while turning on your Mac to boot into recovery mode.
- Click on Utilities from the Menu Bar and select Startup Security Utility.
- In the Secure Boot window, select No Security.
- Restart your Mac and check if VirtualBox works now.
- If the error persists, something else is likely the culprit. You can follow the same steps to re-enable Secure Boot and proceed to the other fixes.
Clear Kext Cache
You can use the sudo kextcache --clear-staging
command to clear the kernel extension cache and potentially resolve this error. If the command doesn’t help initially, here are some further steps you can take:
- Restart your Mac and use the command again.
- Uninstall VirtualBox, restart your Mac again, and reinstall VirtualBox.
- Check if the error is resolved now.
Change Kernel Extension Flag
Some users have also reported cases where the restricted flag was not set against KernelExtensionManagement. This affected how SIP interacted with the directory and ultimately led to the VirtualBox Kernel Driver Not Installed error. Here’s how you resolve this error in such cases:
- Uninstall Virtualbox and restart your Mac.
- Hold Command + R to boot into recovery mode and select Utilities > Terminal.
- Execute the following command to change the flag:
chflags restricted /Volumes/Macintosh\ HD/private/var/db/KernelExtensionManagement
- Restart your Mac and reinstall VirtualBox.
How to Fix This Error on Linux?
The fixes listed below are intended for Debian-based distros, but you can slightly modify and apply them to most other distros as well.
Resolve VBox Kernel Module Issues
The following steps will help resolve a number of potential issues with the VirtualBox kernel module that could be causing this error:
- First, try reinstalling the VirtualBox kernel module with the following command:
sudo /etc/init.d/vboxdrv setup
- If that doesn’t help, update the Linux kernel headers, reconfigure the VirtualBox package and load the module as such:
sudo apt-get install linux-headers-$(uname -r)
sudo dpkg-reconfigure virtualbox-dkms
sudo modprobe vboxdrv - If the error still persists, execute the following commands to remove VirtualBox completely and reinstall it:
rm -r /etc/init.d/vboxdrv
rm -r /var/lib/update-rc.d/vboxdrv
sudo apt-get remove virtualbox-dkms
sudo apt-get install virtualbox virtualbox-dkms virtualbox-guest-utils virtualbox-guest-additions virtualbox-qt - Check if the error is resolved.
Change GCC Version
There’s a common issue where the VirtualBox Kernel Module doesn’t load because the kernel doesn’t match with the GCC version used to compile the module. In such cases, you must use the same compiler used to build the kernel.
For instance, to change the GCC version to GCC 8, you would take the following steps:
- First, remove VirtualBox and its config files with the following command:
sudo apt-get purge virtualbox-*
- Next, install the GCC version you want, which in this example is 8:
sudo apt-get install gcc-8 g++-8
- Set the default GCC to GCC 8:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
- Finally, reinstall VirtualBox and check if the issue is resolved.
Fix Module Signature Issues
DKMS modules are generally configured at installation to work with Secure Boot. But if there are module signature issues, the module won’t be allowed to load. You can easily confirm this by temporarily disabling Secure Boot. Here are the steps to do so on Ubuntu:
- Execute the
sudo mokutil --disable-validation
command. - Enter a temporary password and confirm it.
- Reboot your system and press any key on the MOK Management screen.
- Select Change Secure Boot State and enter the temp password.
- Select Yes > OK to disable Secure Boot.
- You can use the
sudo mokutil --enable-validation
command to re-enable Secure Boot later if you want.
If you’re uncomfortable with disabling secure boot, the second way to fix the module signature issue is by signing the modules yourself. Here’s how you can do this:
- First, use the following command to create a new MOK key:
sudo update-secureboot-policy --new-key
- Next, run the appropriate
kmodsign
command to sign the module. - After it’s signed, run
sudo update-secureboot-policy --enroll-key
to run the enrollment wizard, or enroll it manually by runningsudo mokutil --import <your key>
.
If you’re having difficulty manually signing the VirtualBox Kernel Modules, there are some excellent guides on this on GitHub and the Ubuntu blog.