WSL: WSL2 systemd RemoteApp connection invalid / WSLg apps not working
Version
Microsoft Windows [Version 10.0.22000.978]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.15.62.1-microsoft-standard-WSL2
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
Installed pre-release https://github.com/microsoft/WSL/releases/tag/0.67.6
Added
[boot] systemd=true
to /etc/wsl.conf
Expected Behavior
Working WSLg apps with no alert windows.
Actual Behavior
When I start WSL I get an alert windows with the text “The connection information for this resource is invalid”
Clicking OK closes the windows for a second before it appears again.
Starting a second fresh WSL instance of another distro gives the same error, even though systemd=true is not set
Trying to start an app with WSLg, for example firefox doesn’t work. On the first WSL instance I get the following
$ firefox
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0
$ DISPLAY=:0 firefox
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0
Trying the same on the second instance firefox runs, but a window for it is never presented.
$ firefox
Error: no DISPLAY environment variable specified
$ DISPLAY=:0 firefox
[GFX1-]: glxtest: libEGL missing
[2022-09-26T07:25:12Z ERROR glean_core::metrics::ping] Invalid reason code startup for ping newtab
Missing chrome or resource URL: resource://gre/modules/UpdateListener.sys.mjs
^CExiting due to channel error.
Setting systemd to false on the first instance and running wsl --shutdown restores all WSLg functionality and no alert windows show when starting WSL
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 24 (4 by maintainers)
Hey again. For the record, launching
wslwithgenieis now outdated, and I think this is related to this popin error.Fix: I completely uninstalled
wsl, reinstalled it, then enabled systemD support the right way (withoutgenie). https://gist.github.com/4wk-/889b26043f519259ab60386ca13ba91b @wojtekow RemoteApp error is gone after this clean uninstall then reinstall.Hope it helps someone!
@benhillis
Oh! This is all a bit speculative, if you’ll forgive me, but it seems to me that this all makes sense if it’s a race condition.
If I’m right and your setting up of /tmp/.X11-unix happens in parallel to the systemd startup, then depending on how fast systemd startup runs, either systemd will mount /tmp first, then the setup happens, and you end up with a working system with the /tmp/.X11-unix mount visible; or /tmp/.X11-unix will be setup first, then systemd will automatically mount /tmp on top of it, and you end up in my scenario in which /tmp/.X11-unix is empty because the mount point is hidden.
(The chronological ordering of /proc/mounts supports this, because mine - gist here, as it’s long - clearly shows the second ordering of the mounts hiding the mount point. I would guess that of your working system would show the opposite ordering.)
That would explain how some people get working systems and some don’t, and how in the non-working case, unmounting the tmpfs /tmp reveals the /tmp/.X11-unix bind mount set up “underneath” it, in the underlying mount point directory.
Plausible?
@NotTheDr01ds
I wrote up a whole discussion of the topic here, but to sum up the relevant bit, on my system the /tmp/.X11-unix folder never appeared despite those /dev/null-ed tmpfiles.d files, and I’m pretty sure it’s because systemd is mounting a fresh new tmpfs over /tmp as part of its boot process well before we get to that point.