question

IanFoulds-0295 avatar image
0 Votes"
IanFoulds-0295 asked ·

WSL2 on Azure Windows 10 VM

I am evaluating a Windows 10 2004 VM on Azure but need to run my distro as a WSL2 instance for performance reasons. Git and grep are painful on WSL1.

I cannot get the Hyper-V features installed required to run WSL2. Running the following fails with the errors shown:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
The term 'Install-WindowsFeature' is not recognized as the name of a cmdlet


Import-module servermanager
The specified module 'servermanager' was not loaded because no valid module file was found in any module directory.

This is looking very much like nested virtualisation on an Azure VM is not going to work, in which case this project is dead in the water.

Am I missing something or is MS purposefully preventing developers from running the latest, and IMHO brilliant, features for WSL.

Many thanks.
Ian.

azure-virtual-machines
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLaude avatar image
1 Vote"
LeonLaude answered ·

Hi,

You'll need to choose an Azure VM size that is capable of nested virtualization, check for the SKU Family with Hyper-threaded and capable of running nested virtualization:

Azure compute unit (ACU)
https://docs.microsoft.com/en-us/azure/virtual-machines/acu


More information here:

How to enable nested virtualization in an Azure VM
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nested-virtualization


Best regards,
Leon


· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanFoulds-0295 avatar image
0 Votes"
IanFoulds-0295 answered ·

Hi Leon

I was aware of how to enable the nested HV, that's what led me to my original post as it didn't work. I was however unfamiliar with the list of sizes that supported nested HV, many thanks for that although most are well outside the budget for a WSL2 development machine.

I have changed the VM size to D2s_v3 but I stall can't enable nested VMs, the commands still report the same errors as my original post. Do I need to reload the OS to pick up the changes? I hope I don't need to trash the VM and start again as I got charged £25 just for provisioning it.

Many thanks
Ian.

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Most likely have to reinstall from scratch, I also believe you might need the OS to be Windows Server 2016 or 2019, or Windows 10 Anniversary edition VM.

0 Votes 0 · ·
IanFoulds-0295 avatar image
0 Votes"
IanFoulds-0295 answered ·

Thanks Leon, I'll try a reload. It has to be the latest W10 release V2004 to support WSL2. Previously this was only available via the Windows Insiders program. I've been using it locally here for some time and just updated to the final release. I need to move to a cloud solution for other reasons.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanFoulds-0295 avatar image
1 Vote"
IanFoulds-0295 answered ·

I recreated the VM and it was still failing with exactly the same errors. Then I remembered that things were different when I did this on my local machine a while back, the commands for installing Hyper-V on Windows 10 are not the same:

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v

It now works!!

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes they are different for Windows Server and Windows 10.

Windows 10

 Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Windows Server

 Install-WindowsFeature -Name Hyper-V -ComputerName <computer_name> -IncludeManagementTools



0 Votes 0 · ·