how to get Oracle vm VirtualBox 6.0 and wsl working at the same time
I found it! After much research, and trial and error, here is what enabled me to run VMs in VirtualBox on Windows 10 with Windows Subsystem for Linux installed:
In an elevated (admin) cmd.exe
or PowerShell, do:
bcdedit /set hypervisorlaunchtype off
and make sure Hyper-V and Windows Sandbox are disabled in Windows Features (which you can get to by entering OptionalFeatures.exe
at a command prompt, or via the Control Panel).
Also, Virtualisation options should be enabled in the BIOS, and I think (I don't have time to test right now) that "Virtual Machine Platform" and "Windows Hypervisor Platform" should be enabled.
VirtualBox 6.0.14, Windows Version 10.0.18362.356.
VirtualBox + WSL2 (on Windows 10 & 11) ð
It's possible to have VirtualBox and WSL2 running at the same time on Windows 10 as well as on Windows 11! Please note that when running both in parallel, VirtualBox is then only capable of running in its slower software virtualization mode.
To setup both systems, make sure that the virtualization options are enabled in your BIOS!
- Virtual Box - install the newest version on your machine (official download)
- WSL2 - simply run the command
wsl --install
in an elevated PowerShell or CMD (official docs)
Troubleshooting
Necessary Windows Features?
Installing WSL via the command line should automatically turn on the following Windows features:
- Virtual Machine Platform
- Windows Subsystem for Linux
WSL uses the Hyper-V architecture underneath but the actual Hyper-V features doesn't need to be enabled. In other words: WSL uses the Hyper-V architecture but not the Hyper-V feature (thanks @Cito).
Enable/Disable Windows Features
You can find and edit the Windows features via:
- Open Control Panel > Programs > Turn Windows Features on or off, or
- Enter
OptionalFeatures.exe
into a CMD or PowerShell terminal
Using Windows Home?
If you are running Windows Home, some features might not be installed on your machine. To manually add those virtualization features follow this tutorial.
WSL stopped working?
If you already had WSL installed and made changes to Windows features, WSL might have stopped working all together. Especially when WSL was installed via one of the old methods (not via the wsl --install
command line). To repair the WSL installation, you can do the following:
- Uninstall and remove WSL completely from your system (backup your files if needed!)
- Deactivate all virtualization features
- Restart machine
- Do a fresh and clean install of WSL via the command line
wsl --install
- Restart machine again
Slow VirtualBox VMs?
If you see this green turtle symbol in the guest window's status bar, VirtualBox is running in software virtualization mode (which is really slow!). The hardware virtualization mode would be displayed with this blue symbol .
When running in software mode, the reason is most probably an active WSL setup, which relies on the Hyper-V architecture. Another reason could be the Hyper-V features to be turned on. To get back to hardware virtualization mode, make sure that the following features are turned off:
- Hyper-V
- Windows Hypervisor Platform
and that the hypervisorlaunchtype
is set to off
in the Windows Boot Configuration Data (BCD) store. To do so, run the following commands from an elevated command line:
bcdedit /set hypervisorlaunchtype off
After changing the BCD, a reboot is required.
More Information
For more information on:
- VirtualBox virtualization modes in relation to the Windows features, see the official thread
- Mircosoft WSL and VirtualBox in combination, see the official Github thread