VirtualBox VMs cannot start after enabling "Virtual Machine Platform" feature
I'm not able to Start any VMs in VirtualBox and getting this error:
Cannot enable nested VT-x/AMD-V without nested-paging and unrestricted guest execution! (VERR_CPUM_INVALID_HWVIRT_CONFIG).
I reinstalled latest VirtualBox and was same issue still exist.
Note that recently I did WSL2 installation by the following this official documentations so I thought the problem should be related to this installation, and decided to rollback some steps (not Uninstall WSL2 itself) to verify;
After all I found that "Step3: Enable Virtual MachinePlatform feature" was causing this problem:
Before installing WSL 2, you must enable the Virtual Machine Platform optional feature.
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart your machine to complete the WSL install and update to WSL 2.
So I removed this feature and VM Start problem resolved, but after that WSL2 doesn't start now.
Now I'm stuck here what to do, I need both WSL & VMs to working while they are not happy with that feature to Disable or Enable for both.
OS: Windows-10 1909 (Build 18363.1139)
Solution 1:
Update 2021-10-05: Now both WSL2 and VMs works fine on VirtualBox v6.1.26 r145957 (Qt5.6.2)/OS: Windows10 v20H2 b19042
Note 2021-11-22: If you decide to upgrade VirtualBox, noting that it doesn't work in v6.1.28 and it required to install Windows11.
Found that WSL2 is using Hyper-V technology for Linux Virtualization and to working WSL2 which enabling "Virtual Machine Platform" enables the Hyper-V, so it cause conflict with level-2 hypervisors like VirtualBox and unable to start VMs successfully.
by running this command in cmd
(Run as Administrator) you could get the current value:
bcdedit.exe /enum {current} | find "hypervisorlaunchtype"
and to disable it either remove "Virtual Machine Platform" in Windows Optional-Features, or run this command:
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /all /norestart
or with this to disable the Hyper-V:
bcdedit.exe /set hypervisorlaunchtype off
Note: there is no way currently to have both VirtualBox and WSL2 working at the same time when Hyper-V is enabled, so by disabling Hyper-V, you will not able to open WSL2.