Microsoft introduced support for graphical Linux programs on WSL (WSLg) with Windows 10 build 21364. Like the subsystem as a whole, this feature is primarily aimed at developers and admins, who can now find tools from both worlds on one system in a single interface.

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).

The Wayland implementation based on Weston runs in the Linux VM and Windows integration is done via RDP

The Wayland implementation based on Weston runs in the Linux VM and Windows integration is done via RDP

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

wsl.exe --install

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.

The installation of WSL including support for GUI application is now completely handled by wsl.exe

The installation of WSL including support for GUI application is now completely handled by wsl.exe

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.

Installed distros and their applications appear in the Windows 10 Start menu

Installed distros and their applications appear in the Windows 10 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:

[wsl2]
guiapplications=false

Then restart the subsystem with

wsl.exe --shutdown
If WSL fails with an incorrect parameter message you can reactivate the subsystem via the configuration file

If WSL fails with an incorrect parameter message you can reactivate the subsystem via the configuration file

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
When a GUI program is first installed apt downloads a large number of dependencies

When a GUI program is first installed apt downloads a large number of dependencies

After the successful installation, an icon for the tool should appear in the Start menu.

Conclusion ^

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.

+1
avatar
1 Comment
  1. Samir 6 months ago

    I think I remember the first article when this integration was first showcased.  But this seems to be the start of something that will completely unite computing under the Windows banner, with linux and potentially even macos (also unix based) all on one machine, solidifying Windows again as the completely dominant os on the planet.  Great for us stock holders, lol.

    +2

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2021

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account