Hello Rishabh,
It looks like your VM size support nested virtualization beside that you can follow this guide (https://techcommunity.microsoft.com/blog/itopstalkblog/how-to-setup-nested-virtualization-for-azure-vmvhd/1115338) Here a summarized guide to troubleshoot the WSL2 error on your Azure VM:
- Enable Nested Virtualization: Use the command
az vm update --resource-group <rg-name> --name <vm-name> --set additionalCapabilities.nestedVirtualization=true
. Stop and restart the VM if needed. - Install WSL Features: Run
wsl --install --no-distribution
inside the VM. If needed, enable "Virtual Machine Platform" withdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
and reboot. - Verify BIOS Virtualization: Ensure that VT-x or AMD-V is enabled for the VM. Recreate the VM if necessary.
- Test WSL: Confirm WSL2 is working with
wsl --list --verbose
and set default version withwsl --set-default-version 2
. - Check Logs: Use
wsl --update
andwsl --status
for debugging.
References:
If the information helped address your question, please Accept the answer. Luis