Fix for common VirtualBox startup error- Kernel driver not installed (rc=-1908) under macOS
If you are using Oracle VirtualBox under macOS and recently upgraded to one version of macOS to another; you may be familiar with a common error during VirtualBox startup -- 'kernel driver not installed (rc=-1908)'. Can't understand? Well, this error may look like below image:
This error happening to me too since I keep upgrading macOS version 10.9.x to 10.10.x and so on (current version 10.11.6, I don't do fresh installation). Even re-install/uninstall of VirtualBox wasn't solving the issue permanently. Yes, most of the people do that! They keep upgrading VirtualBox to latest version or keep doing re-install thingy; which actually not helpful sometimes. But I found a solution to fix the issue and applying that since then. Now I want to share the trick with you guys also; it's kind of late to share this trick, but better late than never. Don't need to panic if you see something like above image, just relax and open TextEdit (SublimeText, Atom, etc. will be fine too, I personally use Visual Studio Code). Then write following texts into that:
#!/bin/bash
unload()
{
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
load()
{
sudo kextload "/Library/Application Support/VirtualBox/VBoxDrv.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxUSB.kext" -r "/Library/Application Support/VirtualBox/"
}
case "$1" in
unload|remove)
unload
;;
load)
load
;;
*|reload)
unload
load
;;
esac
If you understand shell script then you can understand the meaning of those texts. If you can't, then don't bother reading. Believe me, those texts not going to kill your machine. Now save the file with .sh extension to any location of your hard disk. why .sh extension? Because it's a shell script.
Now need to make this script executable with following command:
chmod +x scriptname.sh
Here, 'scriptname' obviously means your given name of that script. You need to run the command from the directory you've save the script file. Now if you found mentioned VirtualBox error again then simply go to that directory and run following command:
./scriptname.sh
VirtualBox will start smoothly now without any further error. Simple as that! Hope it will save your precious time you decided to waste by re-installing or upgrading VirtualBox.