Announcing WSL 2

Craig Loewen

Craig

Today we’re unveiling the newest architecture for the Windows Subsystem for Linux: WSL 2! Changes in this new architecture will allow for: dramatic file system performance increases, and full system call compatibility, meaning you can run more Linux apps in WSL 2 such as Docker.

What exactly is WSL 2?

Our top requests from the WSL community have been to increase the file system performance, and make more apps work inside of WSL (i.e: introduce better system call compatibility). We have heard your feedback, and are glad to announce that WSL 2 helps solve these issues.

WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version). Individual Linux distros can be run either as a WSL 1 distro, or as a WSL 2 distro, can be upgraded or downgraded at any time, and you can run WSL 1 and WSL 2 distros side by side. WSL 2 uses an entirely new architecture that uses a real Linux kernel.

Microsoft will be shipping a Linux kernel with Windows

Yes, you did just read that heading correctly! We will be shipping a real Linux kernel with Windows that will make full system call compatibility possible. This isn’t the first time Microsoft has shipped a Linux kernel, as we have already shipped one in 2018 when we announced Azure Sphere. However, this will be the first time a Linux kernel is shipped with Windows, which is a true testament to how much Microsoft loves Linux! We’ll be building the kernel in house from the latest stable branch, based on the source available at kernel.org. In initial builds we will ship version 4.19 of the kernel.

This kernel has been specially tuned for WSL 2. It has been optimized for size and performance to give an amazing Linux experience on Windows. We will service this Linux kernel through Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.

Lastly, of course this Linux kernel will be fully open source! When we release WSL 2 we will have the full configuration available online on Github, so you can see how it works and build it yourself. If you’d like to read more about this kernel you can check out this blog post written by the team that built it.

A quick explanation of the architectural changes in WSL 2

WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine (VM). However, WSL 2 will NOT be a traditional VM experience. When you think of a VM, you probably think of something that is slow to boot up, exists in a very isolated environment, consumes lots of computer resources and requires your time to manage it. WSL 2 does not have these attributes. It will still give the remarkable benefits of WSL 1: High levels of integration between Windows and Linux, extremely fast boot times, small resource footprint, and best of all will require no VM configuration or management.

Here’s a quick demo of WSL 2 in action. When we start our distro we get access to a working bash shell in under two seconds, and can run services and apps like docker right away. To summarize: while WSL 2 does use a VM, it will be managed and run behind the scenes leaving you with the same user experience as WSL 1.

You can expect more detail on the exact changes to the architecture posted to this blog in the near future, so please stay tuned!

How much faster is WSL 2?

File intensive operations like git clone, npm install, apt update, apt upgrade, and more will all be noticeably faster. The actual speed increase will depend on which app you’re running and how it is interacting with the file system. Initial tests that we’ve run have WSL 2 running up to 20x faster compared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using git clone, npm install and cmake on various projects. We’re looking forwards to seeing speed comparisons from the community when we release!

Full System Call Compatibility

Linux binaries use system calls to perform many functions such as accessing files, requesting memory, creating processes, and more. In WSL 1 we created a translation layer that interprets many of these system calls and allows them to work on the Windows NT kernel. However, it’s challenging to implement all of these system calls, resulting in some apps being unable to run in WSL 1. Now that WSL 2 includes its own Linux kernel it has full system call compatibility. This introduces a whole new set of apps that you can run inside of WSL. Some exciting examples are the Linux version of Docker, as well as FUSE!

Using WSL 2 means you can also get the most recent improvements to the Linux kernel much faster than in WSL 1, as we can simply update the WSL 2 kernel rather than needing to reimplement the changes ourselves.

WSL 2 will be a much more powerful platform for you to run your Linux apps on, and will empower you to do more with a Linux environment on Windows.

Release details

Initial builds of WSL 2 will be available through the Windows insider program by the end of June 2019.

We will be announcing when the initial release is available right here on this blog, as well as on Twitter. You can follow the WSL team on Twitter below, where you can ask us questions and get more updates on everything WSL.

WSL Team members on Twitter:

  • Taylor Brown @Taylorb_msft
  • Yosef Durr @yosefdurr
  • Sven Groot @svengroot_ms
  • Ben Hillis @benhillis
  • Craig Loewen @craigaloewen
  • Sunil Muthuswamy @SunilMut
  • Brian Perkins
  • Palkesh Soni @sonipalkesh
  • John Starks @gigastarks
  • Craig Wilhite @CraigWilhite
  • Kayla Cinnamon @cinnamon_msft

Thank you so much for your support. We can confidently say that WSL would not be what it is today without its amazing community, and as always, we look forwards to hearing your valued feedback about the new WSL!

-The WSL Team

334 comments

Leave a comment

  • Avatar
    Carlos Guizar

    So if I understand correctly this will be available until end of  June right , because currently I get this output: cguizar@N-20L6PF1JBK83:~$ sudo /etc/init.d/docker start[sudo] password for cguizar:* Starting Docker: docker [ OK ]cguizar@N-20L6PF1JBK83:~$ sudo docker run -it alpine ashdocker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.See ‘docker run –help’.cguizar@N-20L6PF1JBK83:~$ sudo /etc/init.d/docker status* Docker is not runningcguizar@N-20L6PF1JBK83:~$ sudo iptables -Liptables v1.6.1: can’t initialize iptables table `filter’: Table does not exist (do you need to insmod?)Perhaps iptables or your kernel needs to be upgraded.

    • Avatar
      Alastair Cooper

      First question I was going to ask. This is important for me, since I’m currently tied to using VirtualBox for other applications which can’t presently function properly alongside Hyper-V since access to VT-x and hence the ability to run 64-bit applications is blocked. The same is true for VMware.

  • Avatar
    Richard M Stallman

    I’d just like to interject for a moment. What you’re referring to as Windows, is in fact, GNU/kWindows, or as I’ve recently taken to calling it, GNU plus the Windows kernel. Windows is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

    Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called “Windows”, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

    There really is Windows, and these people are using it, but it is just a part of the system they use. Windows is the kernel: the program in the system that allocates the machine’s resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Windows is normally used in combination with the GNU operating system: the whole system is basically GNU with the Windows kernel added, or GNU/kWindows. All the so-called “Windows” distributions are really distributions of GNU/kWindows.

  • Avatar
    Moritz Beutel

    I only wish Hyper-V didn’t require SLAT. It used to work fine without SLAT on Windows Server 2012 (though not on Windows 8.x), and so do most competitor’s virtualization products.

    If WSL2 depends on Hyper-V, and if the SLAT requirement stays, WSL2 won’t run on many older machines (e.g. Core 2), which is a pity.

  • Avatar
    Sven Knurr

    Could we have a transparent path translation please? I like the WSL for what it attempts to do (although I mainly use it to run Plan 9 software on Windows), but having to open files from /mnt/c/… still feels wrong to me.

    • Avatar
      Alex Cohn

      That’s true. I keep my git repos on d:\git, and I switch between git/bash and WSL for different tasks. The former keeps absolute paths as d:/git/repo/path/file and this is compatible with native IDEs, like IntelliJ, for seamless interop. It’s a pity that WSL does not understand these paths.

    • Ish Raqiyun
      Ish Raqiyun

      You’ve been able to change this for sometime:

      sudo nano /etc/wsl.conf

      Then add the following to the file:

      [automount]

      root = /

      options = “metadata”

      Then save and either restart computer, signout and backin, or just restart the LxssManager service in Task Manager. Not it will be at /c and not /mnt/c.

    • Avatar
      紅樓鍮

      Presumably WSL 2 will require Hyper-V, so as long as you can get Hyper-V running inside your VM, you’ll be in good shape.  I can run Hyper-V inside KVM and Hyper-V; I don’t know if it runs on VMware or VirtualBox, but you can try.

  • Avatar
    Ömer Fadıl USTA

    are you talking linux kernel reimplementation or original linux kernel ? if it is real linux kernel you couldn’t bundle a gplv2 licenced product with a non gpl compatible licence otherwise you have to opensource whole windows’s source code and relicense your product with compatible license.

    • Avatar
      Richard Schibly

      You should read section 2 of gplv2 again.

      “These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works…””… Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

      In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.”

  • Avatar
    Tiago Matias

    I’m reallly looking forward for this. It would be a major factor in allowing windows (re)gain a place in the modern development paradigm. With the shift towards toolchain oriented development processes (long gone are the days of just pressing F5 on the IDE) there just isn’t a way to run all the stuff we tipically need (yarn, docker, npm, node, python, ruby) as these things require a proper posix shell to be glued together. Tons of developers have to shift to MacOS or Linux desktops because they provide such a shell with all the GNU tools we know and love. I hope what with WSL2 this changes quickly.

  • Avatar
    Masoom Shaikh

    “Linux kernel inside of a lightweight utility virtual machine (VM)”

    Since this is VM, would all CPU cores be available to it? A common use case is cross compiling. It is highly desirable to fire up all cores for such CPU intensive puposes. What about networking? Will it be NAT’ed? or it can see physical interfaces they way WSL 1 does?

    basically will output of “ipconfig” in cmd.exe and “ip a s” in WSL2 bash match?

  • Avatar
    Kenneth Benson

    I need to know just this: 1)Will it allow FULL access to USB, as in any device can be used (ie. usb connected IoT devices)?

    2)Will CUDA and OpenCL work on WSL 2 for GPU computations?

    If these will not work then I must regretfully decline it’s install and use, and will maintain a separately bootable Linux partition to do my development in.

    • Avatar
      Benedikt Bauer

      Windows – Settings – Updaes and Security – Windows-Insider-Program

      Allow the Insider Updates and switch to the Fast ring. (There’s also a slow ring for getting early updates – think of the slow ring as RC and the fast ring as beta testing)

  • Ish Raqiyun
    Ish Raqiyun

    Been using WSL since mid-to-late 2017 without really any issues to speak of.

    Then I started to learn Docker and Kubernetes, and implement them in to my projects. Basically forced me to start using Ubuntu due to Hyper-V conflicts with my other VMs some of which can’t run on Hyper-V, and Hyper-V doesn’t play with VBox and VMware nicely).

    Sure, you can try Docker Toollboox which uses VBox, but it is incredibly buggy and slow. Thus, switching to Ubuntu solved the issues at the loss of Office and having to run even more VMs (Edge and IE).

    So this is great news to me and hopefully means I can switch back to Windows and run fewer VMs for my needs. So what I’m wondering:

    1. I read somewhere WSL2 and Docker containers in it won’t use Hyper-V so we can run other VMs in VMware or VBox without issue. Is this confirmed?

    2. Does this also mean it will work Kubernetes, kubectl, and minikube?

  • Avatar
    David Refoua

    I couldn’t dream of a day we could have such an amazing technology built into the Windows, by Microsoft itself! I’d like to say that I appreciate all the effort you guys put into developing WSL/2, and would like to see it becoming an standard environment for development on Windows 🙂

  • Avatar
    Warren Leyes

    I would love to see comparison between WSL2 (which as mentioned is a managed vm behind the scenes) vs. Virtualbox VMware etc. to see if it is indeed worth it. I am often running 2-4 Linux virtual machines on Windows. Anybody have any insight?

    • Avatar
      Buğra Balaban

      +1 from me too
      CUDA and OpenCL support is really necessary for faster computation.
      I don’t know how hard to coding WSL2 for gpu but i have idea about easier approach…
      I can completely dedicate my dGPU for WSL2 (if this is easier way to mapping vram without trouble) and use iGPU for windows. After my deep-learning is done. Shutdown linux environment and to use dGPU for windows again!
      I hope windows team consider this idea. Because i saw topic in 2017 about cuda/opengl support 3years gone already this approach can be faster for sure and I’m sure most of people won’t complain about this…

  • Avatar
    Alistair Hardy

    And a release \ devops guy, being able to run Docker properly is huuuuuuuge. Hopefully Docker for Windows will move over to support it nicely. Especially as VS Code announced it’s going to utilise WSL 2 for remote working over SSH. 

    • Kitty Quinn
      Kitty Quinn

      Worth noting that hyper-v is a type 1 hypervisor that supports nested virtualization. VMware and virtualbox do work on top of hyper-v. In fact, the latest versions of virtual box ship with hyper-v detection and integration.

      That said, hyper-v isn’t great and WSL2 is just a gateway drug for linux. Which is where devs should be anyways, fwiw.

  • Avatar
    Nigel Jones

    I use a lowly surface pro (2018) 4GB i5. I use WSL occasionally, and know I can continue to do so. Given WSL2 requires Hyper-V, is it a bad idea to enable on a low resource mobile device? Will it impact power saving, ram consumption? And will WSL2 add more or less overhead? Or is the combo a good one? No qualms on a higher end desktop.

  • Avatar
    Yaniv Bargury

    Sounds like a sneaky way to get me to dump VMware and move to the Microsoft copy cat. Not going to happen. I use WSL as my primary development environment these days because it’s not on a VM. Do you really think that someone that uses WSL is not capable enough to install Linux on a VM themselves. What were you thinking? If WSL not on VM stops being an option I’ll have to  say goodbye to my windows desktop and move to Linux as a host, else I can’t do my job.

  • Avatar
    Stephen Morgan

    I have an application that runs under Linux and performs asynchronous I/O using Linux libaio (esp. the io_submit() call) directly on storage devices such as /dev/sdb, /dev/sdc, and so forth. I would like to run this application under Windows 10 without having to explicitly port it. I wonder whether the new “Windows Subsystem for Linux 2” facility would enable me to run this application? If so, I wonder whether the WSL2 facility would efficiently implement asynchronous I/O itself when interacting with Windows 10? (The application has to be extremely efficient in terms of issuing and scheduling I/Os.) Any help would be appreciated. Thanks!

  • Avatar
    ping zhang

    PS C:\Users\dqzha\ubuntu> wsl –set-version ubuntu-18.04 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:\Users\dqzha\ubuntu> wsl -l -vNAME STATE VERSION* Ubuntu-18.04 Stopped 2PS C:\Users\dqzha\ubuntu> wslThe attempted operation is not supported for the type of object referenced.PS C:\Users\dqzha\ubuntu>

  • Avatar
    ping zhang

    after switch wsl2, can’t start ubuntu: The attempted operation is not supported for the type of object referenced.

    PS C:\Users\dqzha\ubuntu> wsl –set-version ubuntu-18.04 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:\Users\dqzha\ubuntu> wsl -l -vNAME STATE VERSION* Ubuntu-18.04 Stopped 2PS C:\Users\dqzha\ubuntu> wslThe attempted operation is not supported for the type of object referenced.PS C:\Users\dqzha\ubuntu>

  • Avatar
    Stephen Simpson

    WSL has been a nice piece of work from MS.  But going back to a full kernel abstraction sounds retrograde step.  Isn’t the NT kernel designed for this kind of thing?  How did Interix get the job done back in the day?

    • Avatar
      Rich Turner

      Interix “only” emulated a basic POSIX kernel ABI. The modern Linux ABI is more sophisticated and complex.

      Ultimately, the reality is that we’d always be chasing the long-tail of incompatibilities due to the ever evolving Linux kernel ABI and having to mimic and duplicate not only all the Linux kernel behaviors, process, memory, and security model, etc., but also all its quirks and oddities which many apps/tools depend upon and expect. Due to these factors, we’d never be able to run all Linux apps on WSL1 with 100% compat.

      The only way to really do that is to run your Linux apps atop a real Linux kernel within a VM/Container that boots from cold within a few seconds, and only consumes & retains the resources it needs for the work required of it. That’s WSL2.

  • Avatar
    Janne Enberg

    It’s sad to see Microsoft first taking several steps to the right direction and then taking a massive leap backwards by forcing Hyper-V for the people who want to use WSL to improve their ability to do their work. I know from experience that Hyper-V has compatibility issues with other hypervisors that people actually need and want on their machines (e.g. VirtualBox VMs are often needed for full platform-agnostic compatibility with other team members), and even if they ever get fixed, considering how it’s implemented I can’t even begin to imagine the performance penalties and other issues it is going to cause if I try to e.g. run games on the same computer.

  • Avatar
    Thomas Thompson

    WSL is still useless at this point. No netfilter modules so iptables can run, bind9 installs and runs, haven’t tried apache2. And as far as running a docker from wsl, why not just run it natively!? To me that’s putting the cart before the horse. Get the essintials first then work on app compat.

  • Avatar
    sateesh kumar

    Does docker run inside of wsl2 in windows 10 home edition, i am facing this error.

    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

    my windows 10 version:1903

    i am on wsl2 and downloaded ubuntu from ms store

  • Avatar
    Sean Beeg

    I’d like to thank the team at Microsoft for providing this set of tools, which I use on a regular basis on my personal laptops.   Frankly I find it amazing how flexible the NT kernel still is, even today! (NT Executive!).  I realize things are different in WSL2.  Been a long history with unix & linux integration for me in years past, including MKS, cygwin, etc. While I am not seeing as much of a need for these integrations in the last few years on the infrastructure side, I am seeing it on the client side as some developers prefer a windows laptop.  So, my hat’s off to you guys. 

    Looking forward to working with WSL2. I might even setup another laptop with Windows insider just to get it earlier 🙂

    Finally — at work I’ll be building a few windows jump boxes next week for access to a specific environment. One of the tools I am going to provide the various teams I support will be WSL, as they run quite a few different linux based toolsets on Debian/Ubuntu, but need a windows environment for other reasons!

    -Sean

  • Avatar
    Stanton, Andrew

    I just want to know if the CLI is going to DING at what seems like every keystroke or chord that grants velocity to the command line.  TAB, CTRL + LeftArrow, SHIFT + HOME, etc. ESCDING !ESCDING !ESCDING !

  • Avatar
    Anatol

    Hi! Thank you for WSL2!
    I installed WSL2 since about one week and I am very happy that now I have a nice, fast Ubuntu development workflow which I can access from Linux and Windows side. I have installed Docker based DevilBox on Ubuntu which is also nice tool. Important is to install Docker also on WSL2, not on Windows!
    Bad side is that when I do full update of DevilBox, I get my RAM totally full and the computer stops. I have 32Gb RAM and SSD.
    On another computer with 8Gb Ram and HDD, the projects installations are very slow and with errors.
    So, it seems that WSL2 is running on RAM. Is there any possibility to limit the RAM for WSL2 but keep ot working the same fast?

    Now WSL2 runs on C, where the Windows is installed. The more projects I have, the less free space I have on disk C.
    I would like to have WSL2 installed on another disk and keep there all projects..
    I tried to set in DevilBox to load the projects directory from another disk – /mount/f/www but it works VERY SLOW.
    https://devilbox.readthedocs.io/en/latest/howto/devilbox/move-projects-to-different-directory.html

    So, my conclusion is that I must have the full WSL2 on another disk.
    Is it possible?