This article is more than 1 year old

Penguin takeover: We tried running some GUI Linux apps on Windows the official way – and nothing exploded

Microsoft's own distro lurks under the covers and applications magically appear in the Start menu

Hands on Microsoft has released the first public preview of Linux GUI applications on Windows 10 – so we wasted no time in taking it for a spin around the block.

The ability to run GUI applications on Windows Subsystem for Linux 2 is not new – enthusiasts have been able to run them via separately installed X server utilities for years – but the arrival of official support is still something of a game changer. The official support is more ambitious and better integrated than the various unofficial approaches.

The preview comes via the Windows Insider Program, by which developers and enthusiasts can get an early look at forthcoming releases. The latest downloadable build is 21354, but the version that supports WSLg is build 21364, so in our case it was a matter of installing 21354 from an ISO image, logging in with a Microsoft account signed up as an Insider, and then waiting while the later build came down from Windows Update. We also chose to run it in a Hyper-V VM. To do this, it is necessary to enable nested virtualization since WSL also uses Hyper-V. That requires a PowerShell command from the host machine.

Once build 21364 is up and running, it is a matter of running wsl --install from an administrator command prompt. This does more work than before as WSLg is included automatically. There is quite a lot to it: with WSLg we were installing not one but two WSL2 VMs, one of them the user distro Ubuntu, the other a hidden system distro using Microsoft's own CBL-Mariner Linux. This distro describes itself as "an internal Linux distribution for Microsoft's cloud infrastructure and edge products" so its forthcoming arrival on millions of Windows 10 PCs is a considerable expansion of its role.

That system distro runs Weston, which is a reference implementation of a Wayland compositor. "Weston is the heart of WSLg," said Microsoft's Steve Pronovost, partner development lead. The distro runs a Remote Desktop Protocol server called FreeRDP which lets users connect using a Windows Remote Desktop client. Microsoft extended FreeRDP to support individual windows instead of the whole desktop, added support for per-monitor DPI scaling, and clipboard support so users can cut and paste between Windows and Linux applications.

WSLg diagram showing the role for RDP and that of a second, hidden Linux distro running Microsoft's own Linux

WSLg diagram showing the role for RDP and that of a second, hidden Linux distro running Microsoft's own Linux

Weston in WSLg plays another small but significant role. It includes an RDP plugin which scans the user distro for desktop applications then adds them to the Windows Start menu complete with the command-line for launching them. In practice this makes a big difference to the user experience since Linux GUI applications are found and launched in the same way as native Windows applications.

With WSLg installed, we logged into Ubuntu, updated the packages then typed sudo apt install gedit. Gedit is the standard GNOME text editor. Since Ubuntu in WSL is by default non-GUI, installing the first GUI application pulls down a lot of stuff, but it worked and Gedit duly turned up on the Start menu, where it was called Text Editor (Ubuntu). Once launched it appears in the taskbar with a penguin overlay icon and (in our case) an ugly "[WARN: COPY MODE]" prefix. What is copy mode? Possibly this indicates use of RAIL (Remote Application Integrated Locally) which is a means of displaying remote applications described here, rather than VAIL (Virtualized Application Integrated Locally). RAIL copies pixels over RDP whereas VAIL uses memory shared between the host PC and the WSL2 VM. WSLg is meant to use VAIL but perhaps falls back to RAIL in some circumstances. According to the docs, both RAIL and VAIL are now implemented in FreeRDP.

Linux GUI applications appear automatically on the Windows Start menu

Linux GUI applications appear automatically on the Windows Start menu

Despite the warning, Gedit worked well, with copy and paste working fine to and from Notepad. Getting more ambitious, we tried sudo apt install libreoffice. This large application pulled down many more dependencies, but it worked and we found seven additional applications on the Start menu, these being the components in the LibreOffice suite. LibreOffice Writer opened on the Windows desktop and despite once again warning of "COPY MODE" performed well. We did encounter some slight glitches with clipboard support. Copying text from Word on the host PC (that is the host of the VM running Windows 10) raised a "not supported" error, though on a subsequent try it worked correctly.

The developer story for WSLg is particularly important, given that much of the initial impetus for WSL came from the need to support developers working on Windows but coding applications for Linux servers. Visual Studio Code running on Windows has good remote support for WSL, but what about running the Linux build of VS Code instead?

A quick sudo apt install code did the trick, and there is a little less friction using VS Code in this way if the source code is on the WSL2 file system. Incidentally, saving documents in Linux GUI apps works as expected, displaying a floating Linux Save dialog which defaults to the home directory of the user on the WSL2 side. The Windows host file system is also available via /mnt/c/Users/tim/Documents, for example.

Linux applications running on Windows: Firefox, LibreOffice, Gedit and VS Code

Linux applications running on Windows: Firefox, LibreOffice, Gedit and VS Code

Getting the best performance from WSLg would mean running it on bare metal rather than in a VM, and installing a GPU driver that supports hardware-accelerated OpenGL on the WSL side. These are available in preview from AMD, Intel, and Nvidia – but will not help when the host machine is itself a VM. This is important since it means graphical applications will run with hardware-accelerated performance. It also enables general-purpose GPU development such as with Nvidia's CUDA language, running in WSL2. This is important for developing AI and ML applications, destined to be deployed to Linux servers, among other uses.

It is early days, but looks like good news for developers working on Windows, and perhaps for general users as well, once the technology makes its way into the majority of Windows 10 installations. It is also good for Linux enthusiasts not running Windows since the potential user base for Linux applications will become much larger. ®

More about

TIP US OFF

Send us news


Other stories you might like