Posted on 04/23/2021 12:18:11 PM PDT by ShadowAce
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
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.
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.
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. ®
This article reminds me of something I’ve been meaning to do since year 2006; Go see the movie “Happy Feet”.
A movie full of singing, dancing Penquins!
The previews told me this might be a fun film to see.
I’ll see it one of these days.
Yeah, I’ll stick with running Linux apps on Linux thanks.
Kubuntu 20.04 running great on my 7 year old ThinkPad W530
It’s a bit curious why Microsoft would want this. It’s also an admission that Linux desktop apps are appealing enough to run on Windows.
Thanks for posting.
Win ping.
To me this is upside down. Why take a great OS like Linux and force it to be run underneath Windows. What would be wrong with Windows running underneath Linux?
Or better yet, Windows apps running natively on Linux (Visio, MS Project)
I don’t quite understand this. Usually IF I need windows, which is rare, I just remote into the Windows VM in Proxmox. If Windows crashes then it crashes why take the whole server node with it? I’m not sure why the other way around would be necessary when 99% of linux distros just work as is.
Yup. Duel booting is preferable for computers with average or better CPUs as Linux has multiple configurations designed for low demands. Did one myself after reading people’s problems with that - just a matter of resetting the boot sequence. But I’m an idiot.
My inner geek died about 10 years ago. So, excuse the stupid question. Is this Windows for Linux, or Linux for Windows?
Like others have said I’ll stick to running linux apps on linux but at tge same time there are likely legitimate use cases where this would be a good thing.
Yep... Why go use another OS to run an OS that works better than the OS that is hosting it... lol
Dumbest thing I have ever heard of. “Let’s add a middle man!” WHY???
I’ll answer that... NOTHING. They are trying to steal it and claim it their own as proprietary. It has already been predicted that MS would try this if we let them try to integrate or support anything Linux period. Soon it will be “well from what I understand, you cannot use Linux unless you have windows to run it?”.
Watch, here it comes...
Windows trying to steal Linux...
Slackware user since about 2000 myself. Difficult but I learn a lot.
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.