After a couple of months without working with Virtual Machines, I tried to launch an old ubuntu 20.04 machine in VirtualBox to test some stuff. Curiously, I got a kernel panic error, whose "solution" ended up causing the exception that I'm going to solve in this article. I updated VirtualBox 6.1.16 to the 6.1.28 version and tried to launch the machine again but without success.
After some research and applying the solution that I'm going to show in this article, the virtual machines were able to work again as usual.
How to fix
To fix this error, launch a new command prompt with administrator rights (important). Then, proceed to disable Hyper V by running the following commands:
bcdedit /set hypervisorlaunchtype off
Then run this one:
DISM /Online /Disable-Feature:Microsoft-Hyper-V
Finally, be sure to restart your computer, try launching your virtual machine once again and voila! It should work now.
Notes about this problem
Normally, this will only appear the first time that you work with VirtualBox. However, if the problem reappears a couple of months later after installing a new version of VirtualBox, you may be probably using Docker Desktop as well in your computer. Am I right?:
In case you're not using Docker, if you decide to use it, you will enter into this error cycle whenever you want to work one day with VirtualBox and the other day with docker, as for Docker in order to properly work, HyperV, Virtual Machine Platform, Windows Subsystem for Linux and the Windows Sandbox features must be enabled in your system (check docker docs). So, if you're done with VirtualBox for today and want to work tomorrow with Docker, be sure to enable the services again:
bcdedit /set hypervisorlaunchtype auto
And this one:
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
And restart for the changes to take effect.
Happy coding ❤️!