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.
Craig Loewen
Craig Loewen

Program Manager, Windows Developer Platform

Follow Craig   

61 Comments
Avatar
austin m 2019-06-12 19:15:33
Does this mean Docker will work out of the box now?
Avatar
Byron Adams 2019-06-12 23:48:58
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 2019-06-13 01:42:08
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
启宇 严 2019-06-13 02:50:25
Since it has a "real" Linux kernel, can I switch the init from the one by Microsoft to systemd? 
Avatar
Ivch 2019-06-13 03:53:25
Can we run KVM (hypervisor 1) for accessing directly the hardware? 
Avatar
Anthony Truskinger 2019-06-13 05:51:56
"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 2019-06-13 07:06:44
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
Zac Kruger 2019-06-13 07:32:07
is there a method for setting the number of vcpus in wsl 2? the default appears to be limited at 8 and Set-VMProcessor doesn't appear to be an option since it can only access discrete VMs.
Avatar
Hisham Mounir 2019-06-13 08:33:38
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
Krzysztof Rapacki 2019-06-13 08:50:52
So because this runs on top of Hyper-V does it mean we cannot use it together with other virtualization software like vmware?
Avatar
Tim Man 2019-06-13 08:59:58
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 2019-06-13 10:27:35
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
Aaron Beckett 2019-06-13 10:33:01
I am currently running WSL and trying to convert to 2 using "wsl --set-version Ubuntu 2" returns "Invalid command line option: --set-version" and the usage printout.
Avatar
Hank Jones 2019-06-13 12:25:48
Thanks for the article Crag.   So now the WSL is installed, how do I access the shell?  The newbie...
Avatar
Pengzhi Sun 2019-06-13 18:56:25
Do we have plan to support centos in wsl?
Avatar
anonymous 2019-06-13 20:52:09
This comment has been deleted.
Avatar
jhx 2019-06-13 21:00:38
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
Eugene Aseev 2019-06-13 22:29:11
This build breaks VirtualBox: https://forums.virtualbox.org/viewtopic.php?f=6&t=93519. Are there ways to fix it?
Punit Kishor
Punit Kishor 2019-06-13 22:35:43
`Since WSL 2 now runs in a virtual machine`. Does this mean that WSL 2 will not run on Windows Home edition?
Avatar
裕 永幡 2019-06-13 23:55:21
Is this architecture called "subsystem"? It sounds just like "Windows virtual system for Linux"(WVL).
Avatar
Moravec Vojtech 2019-06-14 02:58:40
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
Ivan Chepurnyi 2019-06-14 03:43:37
Is it going to be possible to specify a different file location for Image file? At the moment when I try to move the application to a different drive, it just fails to do so. 
Avatar
Constantine Molchanov 2019-06-14 03:56:47
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 2019-06-14 04:04:26
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 2019-06-14 05:25:05
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 2019-06-14 06:32:59
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
Daniel N. 2019-06-14 11:56:33
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. 2019-06-14 12:06:09
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 2019-06-14 12:19:30
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 2019-06-15 03:57:49
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 2019-06-15 09:27:48
"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
Paweł Urban 2019-06-15 14:58:36
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 2019-06-16 08:56:44
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
Alex.Vera003 2019-06-17 16:09:56
I think I'll stick to my hackintosh for development for a couple more years until this has a more native feel to it 
Avatar
Ahmed Saber 2019-06-18 11:28:31
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.
Avatar
Ian Cottam 2019-06-20 03:27:16
Has anyone experience of running WSL 2 on an Apple MacBook (running Windows 10/64 via Bootcamp of course). To be more specific, I'll be getting the latest MacBook Air shortly. Thanks.
Avatar
Eric Shufro 2019-06-20 05:47:00
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