- New Group Policy settings in Windows 11 23H2 - Mon, Nov 20 2023
- Windows Server 2025 will support SMB over QUIC in all editions - Fri, Nov 17 2023
- Switch between Windows Terminal and the legacy console - Thu, Nov 16 2023
The subsystem for Linux initially had only the goal of running a Linux shell, together with the most important command line tools, natively under Windows. With version 2, it made a big leap forward by getting its own Linux kernel running in a utility VM. In addition, it uses a native EXT4 file system.
In the fall of 2020, Microsoft announced plans to allow graphical Linux programs to run under WSL. The first publicly available version is now available as an early preview in build 21364 of Windows 10.
Wayland instead of X11
Traditionally, graphical Unix programs were based on X11, but most newer applications use the modern Wayland platform. Compatibility with X11 is ensured by XWayland.
Microsoft apparently considered remoting the Wayland protocol from Linux to the host OS and displaying the programs' output there via a Wayland compositor developed specifically for Windows.
Instead, the manufacturer decided to use the Wayland reference implementation Weston and run it in its own WSL system distro. This is a CBL-Mariner that is maintained by Microsoft itself.
Windows integration over RDP
Weston has an RDP backend based on FreeRDP to display Linux programs via remote desktop. WSLg thus uses a mechanism similar to Hyper-V, where the VM console is displayed on the host OS desktop via RDP.
Microsoft upgraded Weston's RDP capabilities with technologies used in Windows Virtual Desktop (remote application integrated locally, or RDP RAIL) and Application Guard (virtualized application integrated locally, or RDP VAIL).
They ensure that graphical Linux programs appear in their own windows on the Windows desktop. WSLg also supports multi-monitor configurations, audio input and output via a PulseAudio server, and copy/paste between Linux and Windows applications. There are also hardware-accelerated graphics on GPUs with support for WDDMv3.0.
An RDP plugin integrates Linux applications automatically into the Windows 10 Start menu, where Linux distros also show up once added under WSL.
Installation of WSLg
In newer versions, wsl.exe offers an extended set of commands, which also includes the --update parameter. If the subsystem for Linux is already installed, then you simply execute
wsl.exe --shutdown wsl.exe --update
For a new installation, run
The latter performs all the steps you had to do manually in the past, from enabling optional features to downloading the distribution. As an additional action, the tool now downloads and installs GUI app support.
If you do not use the -d switch to instruct the installation command as to which Linux you want, you will automatically get Ubuntu. You can find out which other distros are available via
wsl.exe -l -o
It is also important that you run the selected distribution under WSL 2; version 1 does not support WSLg. With the command
wsl.exe -l -v
you can see the version of all installed distros. If necessary, you can convert them with
wsl.exe --set-version <distro-name> 2
After completing this preliminary work, you will find an icon for the installed distros in the Start menu.
When you run Linux for the first time, WSL integrates it into the system. There, you have to set up an initial account and password.
During my test in a virtual machine, the registration of several distros failed with the error "The parameter is incorrect". Although the issue is known, currently there seems to be no solution. If you want to be able to use WSL2, at least without a GUI, create a file named .wslconfig in the user's profile and add the following entry:
Then restart the subsystem with
Adding graphical Linux programs
If you start up Linux, you don't end up on the graphical desktop, as you are used to from a native installation on bare metal or in a VM. Rather, as before, only a command shell opens from which you first have to install GUI programs.
A package manager is used for this, as is common in Linux. In the case of Ubuntu, this is apt. First you update the package list with
sudo apt update
Then, you can start to install the desired applications. If you want to search for the right software first, you can do that using
apt search <search term>
For example, the popular editor gedit could be added like this:
apt install gedit
After the successful installation, an icon for the tool should appear in the Start menu.
The Linux subsystem is one of the most interesting Windows innovations in years for developers and DevOps. It offers tight integration of the two operating systems on several levels, such as the coexistence of file systems and the ability to start native Windows and Linux programs from the command line.
WSLg continues this development by being able to run graphical Linux programs seamlessly on the Windows desktop. This feature is primarily intended for developer tools rather than for setting up Libre Office for end users.
Subscribe to 4sysops newsletter!
The hardware acceleration of graphical operations, as well as the support for multi-monitor systems, show that Microsoft's ambitions for the integration of Linux go further than just offering a makeshift solution for occasional use.