News: 1619174766

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

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

(2021/04/23)


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.

[1]

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 [2]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.

[3]

That system distro runs [4]Weston , which is a reference implementation of a Wayland compositor. "Weston is the heart of WSLg," [5]said Microsoft's Steve Pronovost, partner development lead. The distro runs a Remote Desktop Protocol server called [6]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.

[7]

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 [8]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.

[9]

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.

[10]

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.

[11]

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

Get our [12]Tech Resources



[1] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2YILvHTzfMopz4UZtB9IbcAAAAAU&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[2] https://github.com/microsoft/CBL-Mariner

[3] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YILvHTzfMopz4UZtB9IbcAAAAAU&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[4] https://github.com/wayland-project/Weston

[5] https://devblogs.microsoft.com/commandline/wslg-architecture/

[6] https://www.freerdp.com/

[7] https://regmedia.co.uk/2021/04/22/diagram.png

[8] https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/485e6f6d-2401-4a9c-9330-46454f0c5aba

[9] https://regmedia.co.uk/2021/04/22/start.png

[10] https://regmedia.co.uk/2021/04/22/wslg.png

[11] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YILvHTzfMopz4UZtB9IbcAAAAAU&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[12] https://whitepapers.theregister.com/

Meanwhile on macOS

Anonymous Coward

By pure coincidence the Microsoft employee currently leading the Homebrew package manager for macOS has kindly been removing X11 and FUSE support from the Homebrew repositories.

Hubert Cumberdale

There will be complaints from the Linux hardcore, but I think it's a good thing, on the whole. Not everyone can work in 100% Linux day to day, and it's nice to be able to use bits of it.

Sorry that handle is already taken.

It finally happened, 2021 is the year of Linux on the desktop!

Not everyone can work in 100% Linux day to day

Mage

Win 10 offers the SAME VM to consumers for incompatible Windows programs that Linux OS users use to run XP and Win7.

It also runs any version of Linux.

Also there is 32 bit and 64 bit WINE and even DOSbox for Win3.x 16 bit.

I agree some people have to run Windows boot. But I had Linux programmes in the Start Menu on NT 4.0 and XP via Services for Unix and a 3rd Party X-Windows server that integrated well to Explorer.

I gave it up when I upgraded to having a 64 bit CPU desktop with VM support. I was then running 32 bit XP and a 64 bit Ubuntu with an Oracle SQL in the VM. You CAN run a 64 bit OS in a VM on a 32 bit OS if the CPU supports it.

Now I only boot Linux Mint and use Wine or VM for Windows applications. Also browser can be more important for some people now. Thankfully Silverlight is in death throws.

I worry...

Jusme

...that this is how Microsoft are going to monetise Linux and Linux applications via their enterprise agreements. I can see a rule in large enterprises that the base OS must always be Windows, suitable licensed and paid for, even if you have mission-critical Linux applications to run. No native Linux allowed (ner ner Red Hat...)

It also perhaps explains why the Wayland display server has been pushed so hard in some quarters...

Re: I worry...

Anonymous Coward

Plenty of other companies have monetised Linux, what's wrong with MS doing the same? Anyway, no matter what they do, MS can'ttake it away from anyone else.

Comparisons please? Benefits please?

Anonymous Coward

How much total memory and disk space is needed on a W10 machine to make all the stuff described in this article work seamlessly?

......compared with a vanilla Ubuntu install? .....compared to a vanilla W10 install?

And if the numbers are large, why would anyone go through the hoops described in the article simply to get gedit to run?

Re: Comparisons please? Benefits please?

Filippo

Chances are the resources required are greater than either, and I don't see how it could be otherwise given that the described setup is basically running both. I really don't think anyone, anywhere, has ever attempted to claim that WSL would be more efficient that straight Linux.

Obviously, you would not do this just to run gedit. But the point of the article is to demonstrate how WSL works, not how some big and complex piece of Linux software works.

Also, the ability to run simple things is a necessary stepping stone on the way to the ability to run complex things. If, every time a system got to that stage, people said "it only runs simple things, so it's pointless", we would not have systems that run complex things.

Re: Comparisons please? Benefits please?

oiseau

Benefits?

None.

And if the numbers are large, why would anyone ...

Why?

Hmm ...

Stupidity?

A "Look Ma !!! ...

I made it can run Linux apps in W10 !" moment?

Who knows ...

All this MS crap is not being pushed to solve anyone's problems.

You can run both Linux and a Windows VM at the same time in a 15 year old Linux host (eg: my Sun Ultra 24 Q9550 + 8Gb RAM) without having to jump through any hoops.

There's a lot of moolah behind all this.

Those of us who have been around IT for ~25 years know what it is all about.

O.

Anonymous Coward

Ohh, start menu integration. I bet Wine (and its slightly agressive default apps integration) will have fun with that ;)

"No I wanted notepad, not notepad (Ubuntu)!" Join the club ;)

sgp

Like the Redmondian Clowns did when they decided a user typing "Internet" in the start menu should be diverted to Edge instead of IE.

Hardly innovation?

Mage

I was demoing this to classes I was giving in 1999. MS Services for Unix, linux applications and a 3rd party X-Window server.

But since January 2017 I wiped the Windows boot & win NTFS partition on my dual boot laptop and made it ext4, and mounted it in home.

I run a choice of VMs on an external 3.5" USB drive. I have 32 bit Wine for some old Windows programs that don't work on 64 bit Win7 or Win10 and some that do. Can't remember when I last ran one.

So it's nice that MS is now "supporting" Linux instead of calling it a cancer. It won't affect much except maybe some devs in corporate places that insist the PC must only boot Windows.

What UNIVERSE is this, please??