VMware Workstation

 View Only
Expand all | Collapse all

WSL2 inside VMware Workstation 16 (Nested Virtualization)

  • 1.  WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 09, 2022 06:37 AM

    I am having difficulty in installing WSL2 on Win 10 VM image using Win 10 under the latest version of VM Ware Pro 16.

    My host machine has:

    • Win 10 Enterprise (21H1 OS Build 19043.1586)
    • WSL2
    • VMWare Pro 16.2.2
    • Docker (4.5.1)

    I can run VVM Ware and WSL2 with Docker at the same time.

    But now i want to be able to have a win 10 VM image where I install WSL2 and Docker but this is not working for me.

     

    I found this link https://superuser.com/questions/1578372/run-wsl2-inside-vmware-workstation-15 Refering to VM Wware 15 and at the very bottom it says that this no longer possible "Note that as of Feb 2022 you cannot run WSL 2 both in a VMware guest and on the host at the same time"

     

    Am I out of luck? Or is there a trick to do this? If not are there any plans to support WSL on the host and guest and allow for what writer calls "nested virtualization"

     

    Thanks in advance,

    max

     

     

     

     



  • 2.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 10, 2022 04:02 PM

    Hi All,

    I am also very intereted to know if this can be done?  I also need to run docker and WSL on the host and also on a win 10 VM.

     

    Tahnks



  • 3.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 10, 2022 10:02 PM

    WSL2 requires Hyper-V to run. Hyper-V API currently doesn't support nested virtualisation with 3rd party hypervisors (such as VMWare Workstation), so you can't run WSL2 both on the host and inside a VMWare VM.



  • 4.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 10, 2022 10:51 PM

    Thank you much for the response do you know if there are any plans to support it  "doesn't support nested virtualization with support nested virtualization with 3rd party hypervisors"

    Thanks

    max



  • 5.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Oct 30, 2022 04:11 PM

    , Reaching back has there been any change to this limitation?
    It's still useful to me to run docker on a Win 10 host but also inside a VM host in VMWare professional 16.x to run isolated experiments. I think this was possible before 16.x but I might be mistaken 

    Thanks for any suggestions 

    max



  • 6.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Oct 31, 2022 11:51 PM

     wrote:

    , Reaching back has there been any change to this limitation?
    It's still useful to me to run docker on a Win 10 host but also inside a VM host in VMWare professional 16.x to run isolated experiments. I think this was possible before 16.x but I might be mistaken 


    This is only possible when using the VMware hypervisor, not when Workstation is using the Microsoft Hypervisor API. As you are running docker at the host as well, you're using WHP.

    Perhaps it is possible with Workstation Tech Preview (I have my doubts, but it might be worth a try)

    --
    Wil



  • 7.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Nov 23, 2022 02:19 PM

    Hi ,   and All,

    While VMWare workstation 16 does not let you do this as you pointed out. 

    VMware pro 17 was released but I could not see anything in the notes that addresses nested virtualization  in order to allow me to run Docker desktop both in the host and inside a VMware VM (win 10).

    Does anyone know if the limitation is still present in version 17.

    Thanks,

    max



  • 8.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Nov 24, 2022 05:04 AM

    This is a limitation of Hyper-V, not so much of VMWare Workstation. Microsoft has hinted that they're working on enabling nesting for third-party virtualization platforms, but they haven't given a date for it. I suspect that, like the ability to run VMWare and Hyper-V on the same system, it will be a borderline surprise announcement. Watch VirtualBox announcements and release notes for the capability, too. That gave a hint on VMWare's then-coming ability to run on Hyper-V systems.



  • 9.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Nov 24, 2022 01:06 PM

     Thank you much for the clarifications.

    max 



  • 10.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 19, 2024 11:26 PM

    Is this still something which is not possible?

    I'm running Workstation on GNU/Linux and I want to run Windows 11 with WSL2.



  • 11.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 20, 2024 11:33 AM

    Hi ,

    For my use case, I have not been able to get it to work - but it used to work on VMWare 15 .

     

    I am on Win 10 Enterprise with VMWare 17.5.1 and I also tried on Win 11 Host the same behavior. Once you turn on virtualization on the VM it does not work if you have virtualization turned on in the Host - at least for me.

     

    But I want to run WSL and Docker simultaneously on my host and VMs and this is where the "nested virtualization" thingy makes it go sideways. 

     

    I followed several suggestions, but I had no luck with nested virtualization support.

     

    An option I found is to turn off the virtualization on the host then VMware images will run, and I can install WSL and use Docker in the VM but at that point I can't run WSL and Docker on the host at the same time.

    It's a compromise and I could adjust by temporarily turning off virtualization on the host. But I am concerned of:

    • The reconfiguration requires a reboot which is really a hassle IMO. 
    • I am unsure if it could permanently break my host configuration forcing me to have to reconfigure WSL and docker on the host the next time to turn it on.  

     

    If you or others have a breakthrough, please share. 

     

    Thanks,

    max



  • 12.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 20, 2024 12:40 PM

    famadorian,

    As your host machine is running Linux, you should be able to run WSL2 inside a Windows 11 VM. The issue of the nested virtualisation only affects Workstation Pro 15.5.5 and later running on Windows 10/11 host OS with Hyper-V enabled.



  • 13.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 20, 2024 02:50 PM

     wow nice I did not know that on Linux host it works. 

    Do you know if there is any plan to address: "The issue of the nested virtualisation only affects Workstation Pro 15.5.5 and later running on Windows 10/11 host OS with Hyper-V enabled."

    I do not think I am the only one who eagerly awaits a fix.

    Thanks,

    max



  • 14.  RE: WSL2 inside VMware Workstation 16 (Nested Virtualization)

    Posted Mar 21, 2024 11:29 AM

    Do you know if there is any plan to address: "The issue of the nested virtualisation only affects Workstation Pro 15.5.5 and later running on Windows 10/11 host OS with Hyper-V enabled."


    Short Answer:
    I don't know. I don't work for VMware and even if I do, I should not be saying anything. But I guess it is likely a limitation of the Microsoft Windows Hypervisor API. So I don't think you should be waiting for a fix to come anytime soon. The problem has been around for 4 years now, longer if you count back to 2017.

    Long Answer (with a little bit of history):
    The nested virtualisation capability (aka VT-x capability inside VMware VMs) has been around since 2011 (Workstation 8.x on Windows/Linux, Fusion 4.x on macOS and ESXi 5.x).

    When Windows 10 1709 was released (the first version that had WSL), Workstation 12.5.x would basically crash when the Windows 10 1709 had WSL installed due to the conflict with Hyper-V. So Workstation 12.5.x, 14.x, 15.0.x users on Windows hosts had to disable WSL/WSL2, Hyper-V, Device Guard, among other things.

    When Workstation 15.5.5 was released, Workstation could now co-exist with Hyper-V enabled on a Windows 10 host. The approach was to use Windows Hypervisor API which would run on userspace (presumably ULM means Userspace Level Monitor) instead of making Intel VT-x calls directly at the kernel level (CPL0 means current privilege level 0, which is Intel terminology for running at ring 0/kernel level).

    https://blogs.vmware.com/workstation/2020/05/vmware-workstation-now-supports-hyper-v-mode.html

    Aside from the performance downside with ULM, nested virtualisation will not work, neither will virtualised performance counters (VPMC). But with CPL0, nested virtualisation works the same way it does since version 8.x plus with all the improvements in Intel VT-x in newer generations of CPUs.

    So this problem of "nested virtualisation" does not affect Linux hosts and ESXi hosts at all.

    For Fusion on macOS, starting with Big Sur, Apple disallowed the use of macOS kernel extensions and Fusion 12.x had to use the Apple Hypervisor Framework API. On Fusion, the nested virtualisation on Intel Macs was not available for a few months and VMware added nested virtualisation on a minor update.

    If you compare the Microsoft Hypervisor API and Apple Hypervisor API online documentation, the Microsoft docs looks quite bare;
    https://learn.microsoft.com/en-us/virtualization/api/hypervisor-platform/hypervisor-platform
    while the Apple docs you can even see that there is a reference to VMCS Shadowing (which is used in Intel CPUs for better nested VM performance).
    https://developer.apple.com/documentation/hypervisor/3182868-hv_vmx_vcpu_set_shadow_access?language=objc

    Fusion on Apple Mx chips still don't have nested virtualisation though.