WSL 2 is now available in Windows Insiders

Craig Loewen

Craig

We’re excited to announce starting today you can try the Windows Subsystem for Linux 2 by installing Windows build 18917 in the Insider Fast ring! In this blog post we’ll cover how to get started, the new wsl.exe commands, and some important tips. Full documentation about WSL 2 is available on our docs page.

Getting Started with WSL 2

We can’t wait to see how you start using WSL 2. Our goal is to make WSL 2 feel the same as WSL 1, and we look forward to hearing your feedback on how we can improve. The Installing WSL 2 docs explains how to get up and running with WSL 2.

There are some user experience changes that you’ll notice when you first start using WSL 2. Here are the two most important changes in this initial preview.

Place your Linux files in your Linux root file system

Make sure to put the files that you will be accessing frequently with Linux applications inside of your Linux root file system to enjoy the file performance benefits. We understand that we have spent the past three years telling you to put your files into your C drive when using WSL 1, but this is not the case in WSL 2. To enjoy the faster file system access in WSL 2 these files must be inside of the Linux root file system. We have also made it possible for Windows apps to access the Linux root file system (like File Explorer! Try running: explorer.exe . in the home directory of your Linux distro and see what happens) which will make this transition significantly easier.

Access your Linux network applications with a dynamic IP address in initial builds

WSL 2 includes a huge architecture change using virtualization technology, and we are still working on improving the networking support. Since WSL 2 now runs in a virtual machine, you will need to use that VM’s IP address to access Linux networking applications from Windows, and vice versa you will need the Windows host’s IP address to access Windows networking applications from Linux. We aim to include the ability for WSL 2 to access network applications with localhost as soon as we can! You can find full details and steps on how to do this in our documentation here.

To read more about the user experience changes please see our documentation: User Experience Changes Between WSL 1 and WSL 2.

New WSL Commands

We’ve also added some new commands to help you control and view your WSL versions and distros.

  • wsl --set-version <Distro> <Version>
    Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture.

    : the specific Linux distro (e.g. “Ubuntu”)

    : 1 or 2 (for WSL 1 or 2)

  • wsl --set-default-version <Version>
    Changes the default install version (WSL 1 or 2) for new distributions.

  • wsl --shutdown
    Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine.

    The VM that powers WSL 2 distros is something that we aim to manage entirely for you, and so we spin it up when you need it and shut it down when you don’t. There could be cases where you would want to shut it down manually, and this command lets you do that by terminating all distributions and shutting down the WSL 2 VM.

  • wsl --list --quiet
    Only list the distribution names.

    This command is useful for scripting since it will only output the names of distributions you have installed without showing other information like the default distro, versions, etc.

  • wsl --list --verbose
    Shows detailed information about all the distributions.

    This command lists the name of each distro, what state the distro is in, and what version it is running. It also shows which distributions is default with an asterisk.

Looking ahead and hearing your feedback

You can expect to get more features, bugfixes, and general updates to WSL 2 inside of the Windows Insiders program. Stay tuned to their experience blog and this blog right here to learn more WSL 2 news.

If you run into any issues, or have feedback for our team please file an issue on our Github at: https://github.com/microsoft/wsl/issues , and if you have general questions about WSL you can find all of our team members that are on Twitter on this twitter list.

Updates:

  • Changed the instruction to access your Linux files from Windows to explorer.exe .
  • Changed first sentence of post to spell out the WSL acronym.

246 comments

Leave a comment

  • Avatar
    Byron Adams

    I installed WSLEnable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

    Path :Online : TrueRestartNeeded : False

    Installed Ubuntu.PS C:\WINDOWS\system32> wsl –set-version Ubuntu 2Conversion in progress, this may take a few minutes…For information on key differences with WSL 2 please visit https://aka.ms/wsl2Please enable the Virtual Machine Platform Windows feature.Not working, what am I missing?

  • Avatar
    lionel.fourquaux

    How does the WSL2 virtual machine change battery life on laptops, compared to WSL1?  Hyper-V used to (maybe still does) disable all sorts of power saving settings, on top of the overhead of virtualization.

    Regarding the network stack, how will you handle IPv6 addresses?  With a neighbor discovery proxy?

    What about unix sockets on the host (C:\) filesystem?  Is it still possible to open them from WSL2 to communicate with the host?

    Is the 9p client on the widows side still restricted to WSL, or is it possible to use it with normal Hyper-V virtual machines?

  • Avatar
    Anthony Truskinger

    “Place your Linux files in your Linux root file system” and files being stored in a VHD are disappointing.

    I understand you’ll be working on this more, but I want to add a voice to this.

    I primarily want my source of truth (my files) to be on the Windows side of things. WSL1 had the perfect working model for me. 

    If I was happy putting files in a VM then Vagrant with a Samba share would do the trick.

  • Avatar
    Sivan Koren

    Good update. In your next post, can you elaborate a bit on why development has taken to the virtual machine direction? Will development continue for wsl1? I think the genius of not having a virtual machine is what makes wsl so great! Can you explain how wsl2 differs from just installing Ubuntu through hyper V? Is the benefit to just share files? Linux drivers to do this are already available from Oracle. What is the goal? We didn’t get that from your post.

  • Avatar
    Hisham Mounir

    Hi, first of all, thanks for developing WSL, I have been a long user for it, now that WSL 2 is out, I got it on my machine, now when I try to convert my current distro (Pengwin WSL linux), it fails to convert, can you please help ?

    PS C:\Users\hisha> wsl –set-version WLinux 2Conversion in progress, this may take a few minutes…For information on key differences with WSL 2 please visit https://aka.ms/wsl2Unspecified errorPS C:\Users\hisha>

  • Avatar
    Tim Man

    What?!? A VM? Can someone explain to me how this is a step in the right direction? This is a giant leap backwards. We have had, already have, and features galore with Linux in a virtualized environment. Why is WSL taking such a huge step back to bring us stuff we have now with VirtualBox or Parallels or VMware “transparency” features to make it seamlessly look like one desktop running on two operating systems? Even if you extend this “unity” feature to somehow include command line somehow, it’s still really two Seperate computers with different everything and selectively sharing via network with filesystem and security and the whole shebang on each side. If Microsoft is starting from a VM, you guys have soooo much catching up to do just to get where they are now and I’m still not sure how it would make Linux any more integrated to windows than it is now.

     

  • Ish Raqiyun
    Ish Raqiyun

    explorer.exe /

    Just opens c:\Users\<user>\Documents

    The correct command should be:

    cd /

    explorer.exe .

    To open the base file system, or…

    cd /home

    explorer.exe .

    To open the /home directory.

    At least the only way I can get File Explorer to open anything in the Ubuntu environment.

  • Avatar
    jhx

    Just joined this to add to the WSL 1 supporters. I’m sure there are good reasons for WSL 2 going virtual, but please understand that the subsystem is the core feature that attracted many of us to WSL in the first place. Until WSL 2 completes the experience of version 1 (the networking change is a real bummer), I certainly won’t be spending any time with it. As average Joe dev going on 16 years experience, WSL 1 kept me on Windows when I was about to make the switch to a complete Linux desktop.

  • Avatar
    Moravec Vojtech

    I would like to know how to use `Visual Studio CMake project` for folder which is located in the root folder for maximum I/O performance.Also I am getting a lot of make’s modification time in the future warnings.

  • Avatar
    Constantine Molchanov

    Hi!

    I’m playing with Docker in Ubuntu under WSL 2, and here’s the only issue I have so far: I cannot access the Internet from containers. First, I noticed that `apt-get update` would fail during image build, but upon further investigation it turned out nothing is reachable from inside the container:“`$ docker run –rm busybox nslookup google.com

    ;; connection timed out; no servers could be reached

    $ docker run –rm busybox cat /etc/resolv.confnameserver 8.8.8.8nameserver 8.8.4.4

    “`

    Otherwise it’s working great. But this is a blocker since I can’t build any images 🙁

  • Avatar
    Jose Castillo

    Docker on WSL 2

    Conversion from WSL 1 to WSL 2 only worked for me using an elevated powershell session:

    PS C:\WINDOWS\system32> wsl –set-version Ubuntu 2Conversion in progress, this may take a few minutes…For information on key differences with WSL 2 please visit https://aka.ms/wsl2Conversion complete.

    PS C:\WINDOWS\system32> wsl –list –verboseNAME STATE VERSION* Ubuntu Running 2PS C:\WINDOWS\system32>

    DOCKER # Follow standard installation for Ubuntu 18.04

    └──☻ sudo service docker status

    Docker is not running

    └──☻ sudo service docker start

    Starting Docker: docker

    └──☻ sudo service docker status

    Docker is running

    └──☻ docker run hello-worldUnable to find image ‘hello-world:latest’ locallylatest: Pulling from library/hello-world1b930d010525: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8Status: Downloaded newer image for hello-world:latest

    Hello from Docker!This message shows that your installation appears to be working correctly.

    └──☻ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS

  • Avatar
    Christopher Parent

    So what is the long term strategy behind moving to a virtual-based WSL? What is the performance cost/impact of running WSL2 compared with WSL1? In terms of capability, I’m assuming this route will allow you to offer a more full-featured Linux experience in the future, but how is this any different than running Linux (with few if any restrictions) in a VM on Windows today? 

    I’m excited MS has been heading down this path for some time – it has allowed me to combine my workflows onto a single machine.

    Don’t shoot me here, but I personally would like to see the Windows UI running on top of .. dare I say … a native linux kernel.  

  • Avatar
    Morris Allison III

    WSL is useless to me now. I already run Linux VMs via Hyper-V, so why would I want to use some watered down version?

    The whole point of the subsystem was that it wasn’t virtualization, so what the heck is this thing anymore?

    Instead of wasting time with this, just improve Hyper-V proper. What a disappointment.

    • Avatar
      Zac Kruger

      There are a lot of reasons why.  Uses less memory, spins up faster, resolves dev/debug scenarios, etc.  Nothing is stopping anyone from using WSL 1 still, as there are no plans to make it go away.  So this anything but makes WSL useless.  That’s just unconstructive feedback.

      • Avatar
        Daniel N.

        The term ‘unconstructive feedback’ is a euphemism created by people who don’t want to listen to feedback. There are things you can take from that, if you are willing to read between the lines. Mainly that Microsoft should put more emphasis on explaining the reasoning behind they decision to make it a VM. Microsoft could ask, why people have issues with VMs and they would probably get some really good answers, too.

        • Avatar
          Zac Kruger

          there is such a thing as unconstructive feedback. the statement “WSL is useless to me now” is a non sequitur because of the fact that WSL 2 is not intended to wholly replace WSL 1.  this has been covered at length by Microsoft in many of their talks, as has your very good point about the reasoning behind leveraging VM technology. unsubstantiated critical blanket statements aren’t doing favors for anyone.

      • Avatar
        Morris Allison III

        Okay, let me expand upon it a bit more. WSL 2 is useless to me, and considering how big of a shift this is, I don’t trust Microsoft to continue to support WSL 1. All of the reasons you listed aren’t concerns of mine, hence why I said, “is useless to me.”

  • Avatar
    Daniel N.

    I’m disappointed learning about the paradigm shift in WSL 2. I was hoping we would be getting a deeper native support. Instead WSL 2 is simply a Hyper-V VM. And moving the storage to VHD is a baffling choice. Not only makes this accessing files from Windows extraordinaly annoying, I also want — no, I need my files to live in my Documents folder, so OneDrive for Business does back them up.

    I don’t suspect that you will completely overhaul how WSL 2 works, so I’ll just pass. What a pity.

  • Avatar
    Daniel N.

    Why did you decide to name the Windows feature Virtual Machine Platform and not simply Windows Subsystem for Linux 2?

    In Windows there are now three features having similar names, that do different things.

    1. Hyper-V Hypervisor

    2. Windows Hypervisor Platform

    3. Virtual Machine Platform

    For people new to Windows virtualization, it’s hard enough do know what the different features do. And then you thought that naming WSL 2 not actually WSL 2, but Virtual Machine Platform? So everyone who want’s to try WSL 2 has to use Google “How to turn on WSL 2”, instead of finding it in the features list. Why do you hate usability so much?

  • Avatar
    Wayne Luke

    The requirement to use an IP address to connect to servers wouldn’t be as much an issue if the WSL instance started with the same IP Address every time. Can I use Ubuntu’s configuration to force an IP address here?

  • Avatar
    Dan Anselm

    will visual studio container tools work with a docker linux container running in wsl2?

    (i run vs in a virtual machine in vmware workstation so docker desktop for windows fails to start linux containers. i only have windows containers as an option unless i run docker machine and wire vs up to that, but then i lose the really convenient visual studio container tools one click debugging!)

  • Avatar
    William White

    “will visual studio container tools work with a docker linux container running in wsl2? (i run vs in a virtual machine in vmware workstation ” @Dan 

    You cannot mix vmware and hyper-v as far as I know.  If hyper v is enabled, vmware and virtual box cannot run.  I’m not clear on if there’s any change to that in wsl 2, but I can’t imagine there is.

    • Avatar
      Dan A.

      hi william, sorry i should have been clearer, hyper-v is running in the guest windows 10 dev vm that i use for my visual studio development and it is this vm that is running inside of vmware. so it is in effect nested and works ok for mostly everything i do including the hyper-v side of things.

      the wsl2 vm will run inside of this hyper-v and i have previously created linux container vm’s using docker-machine successfully as well. the only issue i have is that the mobylinuxvm that docker for windows uses hangs when run inside of nested hyper-v. the only drawback of the docker-machine linux container image is that it can’t handle volumes like the mobylinuxvm can and so one-click visual studio debugging cannot work as it uses those mounted volumes to do lots of stuff like install remote debug tools or something.

      i am hoping that the vs container tools guys will be hooking up with plain old docker running in wsl2 at some point as i know that the docker for windows issue won’t be fixed anytime soon (it has been around for a while) 🙂

  • Avatar
    Paweł Urban

    I would love to test out the new feature (We have also made it possible for Windows apps to access the Linux root file system), but I’ve no idea how can I access the linux filesystem from my programming IDE (Goland or PHPStorm for example). I know that it is possible from explorer.exe – but that’s simply not good enough. Is that even possible? If so – how? Please help! 🙂

  • Christoph Engelbert
    Christoph Engelbert

    Started a build with our Yocto based embedded Linux devkit (which itself runs inside a docker container). With WSL2 I used the Docker daemon running inside the WSL2 Ubuntu. Unfortunately the build failed with a pretty weird error:

    cp: cannot create hard link ‘/opt/builder/build/deploy/ipk/cortexa9hf-neon/linux-libc-headers-dev_4.12-r0_cortexa9hf-neon.ipk’ to ‘./cortexa9hf-neon/linux-libc-headers-dev_4.12-r0_cortexa9hf-neon.ipk’: Invalid cross-device link

    Did anyone see the hard link problem before? Doesn’t happen on full virtual machines.

    edit: The directory would be inside a docker volume mount

  • Avatar
    Ahmed Saber

    I used WSL 1 extensively (bash/ssh/cat/python) with XMING if needed GUI as I develop on both windows and linux in the same time while administering other linux machines. Just installed WSL 2 yesterday but the idea of using VM instead of direct access seems redundant especially if you still can’t access the GPU/USB from Linux kernel which makes it worse than a virtual box machine with ubuntu installed and all features available except GPU access with even more control on the networking part which I am struggling with at the moment to be able to access internet from WSL 2 bash. It looks to be a bit of setback in this direction.

  • Eric Shufro
    Eric Shufro

    Craig and  community,

    Regarding WSL2, is it possible to move the Ubuntu root file system (or home directory) to a dedicated disk?  I would like to make some embedded Linux builds and prefer not to use the space on c:\ that is currently hosting the linux root fs.  Currently, the dedicated disk is mounted to windows as j:\, but when i tried to remove the partitions and mount it to Ubuntu, i was unable to see the device using fdisk. 

    Thoughts?

    Thanks in advance,

    -Eric

  • Avatar
    Daniel N.

    I installed docker in my WSL 2 host and started up a docker container. The container listens on port 80 on the docker0 network (172.18.0.1). The ip address of my WSL 2 host is 172.17.116.166. I can ping the WSL 2 host, but not the docker container. How would I do this now?

  • Avatar
    Konstantin G

    When I used HyperV VMs a few years ago, it wasn’t compatible with VMWare’s. It was inconvenient, I had to reboot Windows into another configuration to switch between them, with `hypervisorlaunchtype off` set in bcdedit.

    Is it still the case for WSL2? Do I have to reboot my PC to switch between WSL2 and vmware?

  • Eric Shufro
    Eric Shufro

    Craig and  community, Regarding WSL2, is it possible to move the Ubuntu root file system (or home directory) to a dedicated disk?  I would like to make some embedded Linux builds and prefer not to use the space on c:\ that is currently hosting the linux root fs.  Currently, the dedicated disk is mounted to windows as j:\, but when i tried to remove the partitions and mount it to Ubuntu, i was unable to see the device using fdisk.  Thoughts? Thanks in advance, -Eric

  • Avatar
    Roman Le Négrate

    Working like a charm in build 18950! Currently playing around with it, having a lot of fun and definitely looking forward to migrating my dev env to it. 

    The first few minutes inside a shell, it already felt faster at the prompt than even my Linux VM, let alone WSL 1. Then I ran a simple CPU-bound single-threaded benchmark and I have to say… WOW ⚡ x12 faster than WSL 1. Amazingly also x2 faster than the VM 😳 Needless to say, I’m eager to finally migrate to WSL full-time. What stopped me from using WSL 1 for real work was the slow I/O (was OK for occasional scripts and light cronjobs), and surely this aspect will have been hugely improved as well.

    Really excited to get this new env going on my new LG Gram 17. Originally planed on installing bare-metal Linux before getting it but now seeing this kind of performance, that won’t be necessary. All-around stellar laptop, btw 😍

    Good job Microsoft! Keep up the excellent work!

  • Paolo Mainardi
    Paolo Mainardi

    HI everyone, just testing WSL2 and wow, such a great piece of software, it’s a huge step forward from WSL and the native integration with vscode-remote it’s uber cool.
    Now, we use primarily Linux and Docker and in our workflow we tend to never use the host port mapping feature, instead we rely on containers ip + dns to access the services for the end use, this helps us a lot to make the docker-compose files more portable and to avoid port collisions between systems.
    This is more or less the same workflow we have on OSX using a docker-machine, where we basically add a static route for the ip space of docker containers from OSX to Virtualbox, it is basically just a command :

    sudo route -n add -net 172.16.0.0/12 $(docker-machine ip dinghy)

    Is this something supported on WSL2 too ? Can i try to add a static route from Windows to WSL2 vm ?

    Thanks!