![]() | This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages) (Learn how and when to remove this message)
|
![]() | |
![]() Bash running on Windows 10 | |
Other names | WSL |
---|---|
Developer(s) | Microsoft |
Initial release | 2 August 2016; 8 years ago (2016-08-02) |
Stable release | |
Preview release | |
Repository | github |
Operating system | Windows 11,Windows 10, Windows 10 LTSB/LTSC,Windows Server 2025,Windows Server 2022,Windows Server 2019,Windows Server 2016 |
Predecessor | Windows Services for UNIX |
Type | Compatibility layer,virtualization |
License | Subsystem:Proprietarycommercial software; Linux kernel:GNU GPLv2 (only) with some code under compatible GPL variants or under permissive licenses like BSD, MIT |
Website | learn |
Windows Subsystem for Linux (WSL) is a feature ofMicrosoft Windows that allows the use of aGNU/Linux environment from within Windows, foregoing the overhead of avirtual machine and being an alternative todual booting. The WSLcommand-line interface tool is installed by default in Windows 11, but a distribution must be downloaded and installed through it before use.[3] In Windows 10, WSL can be installed either by joining theWindows Insider program or manually viaMicrosoft Store orWinget.[4]
The original version, WSL 1, differs significantly from the second major version, WSL 2. WSL 1 (released August 2, 2016), acted as acompatibility layer for running Linuxbinary executables (inELF format) by implementing Linuxsystem calls in theWindows kernel.[5] WSL 2 (announced May 2019[6]), introduced a realLinux kernel – a managed virtual machine (viaHyper-V) that implements the full Linux kernel. As a result, WSL 2 is compatible with more Linux binaries as not all system calls were implemented in WSL 1.[7]
Microsoft offers WSL for a variety of reasons. Microsoft envisions WSL as "a tool for developers – especially web developers and those who work on or with open source projects".[8] Microsoft also claims that "WSL requires fewer resources (CPU, memory, and storage) than a full virtual machine" (a common alternative for using Linux in Windows), while also allowing the use of both Windows and Linux tools on the same set of files.[8]
Microsoft's first foray into achieving Unix-like compatibility on Windows began with theMicrosoft POSIX Subsystem, superseded byWindows Services for UNIX viaMKS/Interix, which was eventually deprecated with the release ofWindows 8.1. The technology behind Windows Subsystem for Linux originated in the unreleasedProject Astoria, which enabled someAndroid applications to run onWindows 10 Mobile.[9] It was first made available inWindows 10 Insider Preview build 14316.[10]
Whereas Microsoft's previous projects and the third-partyCygwin had focused on creating their own uniqueUnix-like environments based on thePOSIX standard, WSL aims for native Linux compatibility. Instead of wrapping non-native functionality intoWin32system calls as Cygwin did, WSL's initial design (WSL 1) leveraged theNT kernel executive to serve Linux programs as special, isolated minimalprocesses (known as"pico processes") attached tokernel mode"pico providers" as dedicated system call andexception handlers distinct from that of a vanilla NT process, opting to reutilize existing NT implementations wherever possible.[11]
WSL beta was introduced in Windows 10 version 1607 (Anniversary Update) on August 2, 2016. OnlyUbuntu (withBash as the default shell) was supported. WSL beta was also called "Bash on Ubuntu on Windows" or "Bash on Windows". WSL was no longer beta in Windows 10 version 1709 (Fall Creators Update), released on October 17, 2017. Multiple Linux distributions could be installed and were available for install in theWindows Store.[12]
In 2017Richard Stallman expressed fears that integrating GNU functionality into Windows will only hinder the development offree software, calling efforts like WSL "a step backward in the campaign for freedom."[13]
Though WSL (via this initial design) was much faster and arguably much more popular than the previous UNIX-on-Windows projects, Windows kernel engineers found difficulty in trying to increase WSL's performance and syscall compatibility by trying to reshape the existing NT kernel to recognize and operate correctly onLinux's API. At a Microsoft Ignite conference in 2018, Microsoft engineers gave a high-level overview of a new "lightweight"Hyper-V VM technology forcontainerization where a virtualized kernel could make direct use of NT primitives on the host.[14] In 2019, Microsoft announced a completely redesigned WSL architecture (WSL 2) using this lightweight VM technology hosting actual (customized) Linux kernel images, claiming full syscall compatibility.[7] Microsoft announced WSL 2 on May 6, 2019,[6] and it was shipped with Windows 10 version 2004.[15] It was also backported to Windows 10 version 1903 and 1909.[16]
GPU support for WSL 2 to run GPU-acceleratedmachine learning was introduced in Windows build 20150.[17] GUI support for WSL 2 to run Linux applications withgraphical user interfaces (GUIs) was introduced in Windows build 21364.[18] Both of them are shipped in Windows 11.
In April 2021, Microsoft released a Windows 10 test build that also includes the ability to run Linux graphical user interface (GUI) apps using WSL 2 andCBL-Mariner.[19][18] The Windows Subsystem for Linux GUI (WSLg) was officially released at theMicrosoft Build 2021 conference. It is included in Windows 10 Insider build 21364 or later.[20]
Microsoft introduced a Microsoft Store version of WSL on October 11, 2021, for Windows 11.[21] It reached version 1.0.0 on November 16, 2022 with added support for Windows 10.
Release / Feature | Preview build | Public build |
---|---|---|
WSL (Beta) (Bash on Ubuntu on Windows) | Windows 10 build 14316 | Windows 10 version 1607 (Anniversary Update) |
WSL (no longer Beta) | Windows 10 build 16251 | Windows 10 version 1709 (Fall Creators Update) |
WSL 2 (lightweight VM) | Windows 10 build 18917 | Windows 10 version 2004 (also backported to 1903 and 1909) |
WSL 2 GPU support | Windows 10 build 20150 | Windows 11 (also Windows 10 21H2) |
WSL 2 GUI support (WSLg) (last version) | Windows 10 build 21364 | Windows 11 |
Version | Comment |
---|---|
0.47.1 | First version |
0.67.6 | systemd support |
1.0.0 | Generally available; Windows 10 support |
The first release of WSL provides aLinux-compatible kernel interface developed by Microsoft, containing noLinux kernel code, which can then run theuser space of aLinux distribution on top of it, such asUbuntu,[22][23][24][25]openSUSE,[26]SUSE Linux Enterprise Server,[27][28][12]Debian[29] andKali Linux.[30] Such a user space might contain aGNU Bash shell and command language, with native GNU command-line tools (sed,awk, etc.), programming-language interpreters (Ruby,Python, etc.), and even graphical applications (using anX11 server at the host side).[8]
The architecture was redesigned in WSL 2,[6] with a Linux kernel running in a lightweightvirtual machine environment.
Thewsl.exe
command accesses and manages Linux distributions in WSL viacommand-line interface (CLI) – for example viaCommand Prompt orPowerShell. With no arguments it enters the default distributionshell. It can list available distributions, set a default distribution, and uninstall distributions.[31] It can also run a Linux command[32] – replacinglxrun.exe
which is deprecated as of Windows 10 1803 and later.[33]
Windows Subsystem for Linux GUI (WSLg) is built with the purpose of enabling support for running Linux GUI applications (X11 andWayland) on Windows in a fully integrated desktop experience.[34] WSLg was officially released at theMicrosoft Build 2021 conference and is included in Windows 10 Insider build 21364 or later.[20] However, with the introduction ofWindows 11, WSLg is finally shipping with a production build of Windows, bringing support for both graphics and audio in WSL apps.[35]FreeRDP is used to encode all communications going from theRemote Desktop Protocol (RDP) Server (in Weston) to the RDP Client (msrdc on Windows[36]) according to the RDP protocol specifications.[37]
Prerequisites for running WSLg include:
LXSS Manager Service is the service in charge of interacting with the subsystem (through thedriverslxss.sys
andlxcore.sys
), and the way that Bash.exe (not to be confused with the Shells provided by the Linux distributions) launches the processes, as well as handling the Linuxsystem calls and the binary locks during their execution.[39] All processes invoked by a particular user go into a so called "Linux Instance" (usually the first invoked process isinit). Once all the applications are closed, the instance is closed.
WSL 1's design featured no hardware emulation / virtualization (unlike other projects such as coLinux) and makes direct use of the host file system (throughVolFS
andDrvFS
)[40] and some parts of the hardware, such as the network, which guarantees interoperability. Web servers for example, can be accessed through the same interfaces and IP addresses configured on the host, and shares the same restrictions on the use of ports that require administrative permissions, or ports already occupied by other applications.[41] There are certain locations (such as system folders) and configurations whose access/modification is restricted, even when running as root, withsudo from the shell. An instance with elevated privileges must be launched in order to get "sudo" to give administrator privileges, and allow such access.[8]
WSL 1 is not capable of running all Linux software, such as 32-bit binaries,[42][43] or those that require specific Linux kernel services not implemented in WSL. Due to a total lack of Linux in WSL 1, kernel modules, such as device drivers, cannot be run. WSL 2, however, makes use of live virtualized Linux kernel instances. It is possible to run some graphical (GUI) applications (such asMozilla Firefox) by installing anX11 server within the Windows (host) environment (such asVcXsrv orXming),[44] although not without caveats, such as the lack of audio support (though this can be remedied by installingPulseAudio in Windows in a similar manner to X11) or hardware acceleration (resulting in poor graphics performance). Support forOpenCL andCUDA is also not being implemented currently, although planned for future releases.[45][46] Microsoft stated WSL was designed for the development of applications, and not fordesktop computers orproduction servers, recommending the use of virtual machines (Hyper-V),Kubernetes, andAzure for those purposes.[8]
In benchmarks, WSL 1's performance is often near native Linux Ubuntu, Debian, Intel Clear Linux or other Linux distributions. I/O is in some tests abottleneck for WSL.[47][48][49] The redesigned WSL 2 backend is claimed by Microsoft to offer twenty-fold increases in speed on certain operations compared to that of WSL 1.[7] In June 2020, a benchmark with 173 tests on WSL 2 (20H2) with an AMD Ryzen Threadripper 3970X showed an average of 87% of the performance of native Ubuntu 20.04 LTS. In contrast, WSL 1 had only 70% of the performance of native Ubuntu. WSL 2 improves I/O performance, providing a near-native level.[50]A comparison of 69 tests with an Intel Core i9-10900K in May 2020 resulted in nearly the same relative performance.[51] In December 2020, a benchmark with 43 tests on WSL 2 (20H2) with an AMD Ryzen 9 5900X displayed an average of 93% of the performance of native 20.04.1 LTS, compared to WSL 1 which only achieved 73%.[52]
Version 2 introduces changes in the architecture. Microsoft has opted for virtualization through a highly optimized subset of Hyper-V features, in order to run the kernel and distributions (based upon the kernel), promising performance equivalent to WSL 1. Forbackward compatibility, developers do not need to change anything in their published distributions. WSL 2 settings can be tweaked by theWSL global configuration, contained in anINI file named.wslconfig
in theUser Profile folder.[53][54]
The distribution installation resides inside anext4-formatted filesystem inside avirtual disk, and the host file system is transparently accessible through the9P protocol,[55] similarly to other virtual machine technologies likeQEMU.[56] For the users, Microsoft promised up to 20 times the read/write performance of WSL 1.[6] From Windows anIFSnetwork redirector is provided for Linux guest file access using the UNC path prefix of\\wsl$
.
WSL 2 requires Windows 11,[57] or Windows 10 version 1903 or higher, with Build 18362 or higher, for x64 systems, and Version 2004 or higher, with Build 19041 or higher, for ARM64 systems.[4]
WSL 2 on Windows 11 retains 95% of the performance of native Ubuntu 20.04 LTS.[58]
WSL 1 does support IPv6 connections as do WSL 2.[59][60] IPv6 support in WSL 2 requires Windows 11 or newer.[61]
In this new update we've added the ability to start using global config options for WSL. These options are targeted towards power users who want to further customize their WSL experience.