Add support for WSL2 Native GUI capability

Bug #1922262 reported by Lucy Llewellyn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Wishlist
Unassigned

Bug Description

I'd like to see Windows Subsystem for Linux 2 (WSL2) support added so that if/when Systemd becomes possible or hacked in via a PID namespace [1] then GUI snaps can be executed without issue. Currently this works fine for non-GUI applications, but WSL has recently enabled native GUI capability via a sidecar distro running a Wayland+Weston server with PulseAudio.

From an examination of how Microsoft are setting up the WSL2 Native GUI capability, the following are important things to note:

WSL sets the environment variables:

DISPLAY=:0
PULSE_SERVER=/mnt/wslg/PulseServer
WAYLAND_DISPLAY=wayland-0
XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir

WSL exposes the following sockets at: /mnt/wslg/runtime-dir/wayland-0

WSL exposes the .X11-unix tree at: /mnt/wslg/.X11-unix This is by default symlinked to /tmp/.X11-unix causing the snap-confine bind mount attempt to fail.

WSL exposes the following PulseAudio sockets:
/mnt/wslg/PulseServer
/mnt/wslg/PulseAudioRDPSink # access may not be needed to this?
/mnt/wslg/PulseAudioRDPSource # access may not be needed to this?
/mnt/wslg/runtime-dir/pulse/native
/mnt/wslg/runtime-dir/pulse/pid # not a socket file but should still be included

In addition, WSL2 starts a dbus daemon which creates the following directory with no files within:

/mnt/wslg/runtime-dir/dbus-1/services/

Also, it appears that a dconf daemon is started with the following runtime file:

/mnt/wslg/runtime-dir/dconf/user

[1]: https://github.com/diddledan/one-script-wsl2-systemd/tree/build-21286+

description: updated
description: updated
description: updated
Changed in snapd:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Daniel, thanks for gathering this information and for investigation, this is interesting! I don't know of any immediate plans for supporting this, but this may change in the future of course.

Also, I noticed you later reported a success with https://forum.snapcraft.io/t/gui-snaps-in-wsl2/23880 ; is there anything to update in this bug report with regard to that story?

Revision history for this message
Lucy Llewellyn (lucyllewy) wrote :

I think everything I mentioned is still accurate. The only thing missing now is 3D acceleration via libraries added to `/usr/lib/wsl/lib` via a mount through the hyper-v socket to the host system. These libraries are referenced in a new file created at `/etc/ld.so.conf.d/ld.wsl.conf`.

Neither the libraries, nor the ld.so configuration letting apps know where they are located, are visible to strictly confined snaps, currently.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.