The Windows Subsystem for Linux (WSL) became open source, Microsoft said Monday. This marks the conclusion of a multi-year effort that started with the first issue on the Microsoft/WSL GitHub repository, which asked if WSL would be open source.
Overview of WSL Components
WSL consists of multiple parts running in both Windows and the WSL 2 virtual machine:
- Command-line tools:
wsl.exe
,wslconfig.exe
, andwslg.exe
let users interact with WSL. - WSL service:
wslservice.exe
handles starting the WSL VM, launching Linux distributions, and mounting file shares. - Linux processes: Such as
init
(startup),gns
(networking), andlocalhost
(port forwarding), run inside the Linux environment. - File sharing: Uses Plan9 protocol to share Linux files with Windows.
Previously open-sourced components include:
- microsoft/wslg: Provides support for graphical Linux apps using Wayland and X server.
- microsoft/WSL2-Linux-Kernel: The Linux kernel source for WSL 2.
However, some parts are still closed source:
- Lxcore.sys: The driver powering WSL 1.
- Filesystem access between Windows and Linux at
\\wsl.localhost
is managed by P9rdr.sys and p9np.dll.
Background and Development
Pierre Boulay, Senior Software Engineer at Microsoft, explained that WSL first launched in 2016 with Windows 10 Anniversary Update as WSL 1. The system used the (lxcore.sys
) driver within the Windows kernel to natively run Linux executables.
In 2019, WSL 2 was introduced with a full Linux kernel running inside a lightweight VM to improve compatibility. As more users joined and requested features, Microsoft separated WSL from the Windows codebase in 2021 and released it as an independent package in the Microsoft Store (version 0.47.1), initially for Windows 11 preview users.
November 2022 saw the release of WSL 1.0.0, the first stable standalone version, which included support for Windows 10 and 11. Windows 11 24H2 helped move users from the built-in WSL to this new package, while keeping wsl.exe
in Windows to facilitate downloads.
Later, WSL 2.0.0 introduced important features such as mirrored networking, DNS tunneling, session 0 support, proxy and firewall support.
Community Contributions and Future
Pierre Boulay noted that the WSL community has played a key role by helping identify bugs and add features despite not having access to the source code. He added that Microsoft expects the open-source release to speed up development by enabling the community to contribute directly.
Code Availability
The complete WSL source code is now available on GitHub at Microsoft/WSL, where developers can access, build, and contribute to it; the latest version is WSL 2.5.7, following many updates since version 0.47.1 released four years ago.