Ubuntu – WSL2 not working within Windows 10 VM in VirtualBox on Ubuntu 18.04.5 LTS

18.04virtualboxwindows 10

WSL2 isn't working for me. Virtualization is enabled in Laptop BIOS AND within VirtualBox VM settings. Here is my configuration.

  • Host: Alienware17r3, Intel i7, 32GB RAM
  • BIOS: Virtualization is enabled
  • OS: Ubuntu 18.04.5 LTS
  • Hypervisor: Oracle VirtualBox 6.12r139181(Qt5.9.5)
  • VM: Windows 10 Home 20H2 (19042.450)
  • VM Settings Enabled: System->Processor->
    Enable PAE/NX
    Enable Nested VT-x/AMD-V
  • Windows Settings -> Optional Features -> More
  • Windows Features: Checked
    • Virtual Machine Platform
    • Windows Hypervisor Platform
    • Windows Subsystem for Linux

Finally tried to launch Ubuntu 20.04 LTS within wsl2:

WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be 
started because a required feature is not installed.

Press any key to continue...

I've tried many times to experiment with docker running in WSL2 on Windows after every Windows update. Virtualization is enabled in the bios and the OracleBox Windows10 VM. However, something is still preventing me from using WSL2 within a licensed Windows OS which is running in a VirtualBox VM on Linux.

Best Answer

After 3 work days of messing with this, the only solution I have found: use VMWare Workstation 16. I downloaded the Windows 10 VMware VM from Microsoft, verified the Ubuntu distribution was using WSL2 with 'wsl -l -v', then launched the Ubuntu distribution successfully on first try.

I duplicated the exact Virtualbox error posted with the following:

Host: P53; BIOS: Virtualization is enabled; OS: Ubuntu 20.04 LTS; Hypervisor: Oracle VirtualBox 6.1.16_Ubuntu r140961 (Qt5 12.8); VM: Windows 10, version 2004 (10.0.19041.0); VM Settings Enabled: System->Processor-> Enable Nested VT-x/AMD-V (same results if you also Enable PAE/NX); Windows Settings -> Optional Features -> More; Windows Features Checked: Virtual Machine Platform; Windows Subsystem for Linux

I also duplicate a similar issue when using VM: VirtualBox VM downloaded here: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/

I kept all of the VM settings Microsoft defaulted for their WSL2 Ubunutu dist to run. When I open the Ubuntu dist I get an error saying I need to enable "Virtual Machine Platform" and or enable virtualization in bios. Clearly these were enabled.

I tried uninstalling and reinstalling multiple times. I have concluded the virtualization feature needed for HyperV virtualizaiton to work in a VM, which is leveraged by WSL2, does not work on Virtualbox version 6.1 on Ubuntu 20.04, despite any claims VirtualBox has made about the feature listed on version 6.1.

Please see here: https://forums.virtualbox.org/viewtopic.php?f=6&t=98448 "Microsoft makes its OS's a moving target now, so the devs have to catch up." If the Virtualbox 6.1 virtualization feature ever worked when installed on Ubuntu, it doesn't now.

A final note, I needed this solution to work for the same reason as the poster. I am testing a powershell script I am writing that will install all of the needed software to run our local development environment. The local env includes an installation of minikube which uses the default docker driver, which on Windows is experimental but works with the workaround posted in the minikube documentation (I wish my teammates would use Ubuntu like I do). When testing the install script, its much easier to snap and restore between test runs on a VM then it is to on bare-metal.

Related Question