Improvements to WSL the community may appreciate

Hello world,

The Windows Subsystem for Linux is often used around here to run the Linux version of ROOT on Windows. It works pretty well, but there’s some usual caveats with X11 support that have been a hinderance historically.

With the release of Windows 11, Microsoft announced improvements to WSL, called WSLg; that included a built in X11 server and Pulseaudio functionality. There’s no user setup required involved, it’s expected that a graphical app would “just work”.

Recently, this functionality has been backported to Windows 10; so that Windows 10 users can now also use WSLg in an official manner. (Context: The Windows Subsystem for Linux in the Microsoft Store is now generally available on Windows 10 and 11 - Windows Command Line)

Furthermore, Microsoft have recently added Systemd support to WSL2 recently, which better emulates “normal” Linux environments; and brings support for specific tech that was previously unsupportable, such as Snaps! (Unfortunately, not the ROOT snap just yet due to a specific bug, but it’s being worked on!). Systemd support is currently based on an opt in basis, by adding/creating:

[boot]
systemd=true

to /etc/wsl.conf, and then rebooting the WSL2 environment (which is easiest to explain by rebooting the whole Windows environment, for the newb friendly sake).

(Systemd context: Systemd support is now available in WSL! - Windows Command Line)


Unfortunately, all this new support in WSL is mirred currently by a rather confusing installation process and naming scheme, that means that it’s not entirely obvious how to benefit from these improvements, by making sure you’re on the latest version. Fortunately, this is also being improved.

This confusion mostly comes down to the fact that each version of Windows has a release of WSL built in and doesn’t change until the next release of the OS image, referred to as an “Inbox” release, and also a separate release available as an appx bundle, which can be downloaded either via Github or via the Windows Store (which would also provide automatic updates to the WSL environment). Users should ideally be using the out-of-image version, to benefit from newest features as they come.

As of December 2022, running wsl.exe --install or wsl.exe --update should transfer people to the Microsoft Store version, which will contain WSLg, Systemd support, etc automatically, for everyone on all supported Windows 10 and Windows 11 releases!

Long story short, this should mean that going forward, there’ll be less reason to advise people to install third party X11 servers, and a more consistent deployment of WSL functionality across all the currently maintained Windows branches.

This should eventually mean that you could tell a user to:

wsl.exe --install
echo -e "[boot]\n
systemd=true" > /etc/wsl.conf
# Always good practise
sudo apt update && sudo apt upgrade -y
# In the windows shell, to actually boot with Systemd, alternatively just reboot Windows entirely
wsl.exe --shutdown
sudo snap install root-framework
# Complete with GUI support, at least once https://github.com/microsoft/WSL/issues/8996 unblocks things :)
# I am shilling myself a little here, the normal pre-compiled binaries, Conda packages, etc; would of course work too

Hopefully this’ll help with support requests going forward; I understand that WSL is recommended here fairly often but also that the core developers aren’t the kind of people who would actively be keeping up with Microsofts announcements relating to it, so hopefully this helps clear to keep everyone in the loop :slight_smile:

5 Likes

Hi @James-Carroll,

(Pinging @bellenot, as this is most probably of his interest.)

Many thanks for sharing all this piece of information! It’s really good to hear that WSLg not only includes a X11 server (previously have been pointing users to install the Xming X11 server), but also PulseAudio.

Also, the better integration with systemd and snap is going to make notably simpler to install the Linux version of ROOT on Windows. :slight_smile:

Again, many thanks for sharing!

Cheers,
J.

1 Like