WSL2 on Azure Windows 10 VM

Ian Foulds 6 Reputation points
2020-06-20T09:36:45.487+00:00

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
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,127 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Leon Laude 85,651 Reputation points
    2020-06-20T09:40:54.167+00:00

    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://learn.microsoft.com/en-us/azure/virtual-machines/acu

    More information here:

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

    Best regards,
    Leon

    2 people found this answer helpful.

  2. Ian Foulds 6 Reputation points
    2020-06-22T09:36:04.017+00:00

    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://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v

    It now works!!

    1 person found this answer helpful.

  3. Ian Foulds 6 Reputation points
    2020-06-20T13:27:30.413+00:00

    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.


  4. Ian Foulds 6 Reputation points
    2020-06-21T10:30:31.01+00:00

    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.

    0 comments No comments