Open cerebrate opened 2 years ago
The failure in this case is obviously from the lack of WSL_INTEROP in systemd-started sessions. It can be worked around, if you have a long-running WSL session, by pushing the WSL_INTEROP environment variable for that session into the system environment block using
systemctl import-environment WSL_INTEROP
at which point it is inherited by all systemd services and sessions.
(The problem with that is that while it was a viable solution for genie, because the init above genie would always be around for as long as systemd would be, there isn't such a guaranteed-present-as-long-as-systemd init around under the native systemd support - and so this workaround relies on keeping one particular WSL session open perpetually to provide the socket behind WSL_INTEROP.)
Thanks - I agree launching Windows processes from things launched from systemd would be a good enhancement and shouldn't be too bad to implement. I'll see what I can do.
Voting for this enhancement - I am specifically prefer to use my XWin instead of wslg and till now i enabled it from systemd user unit. Unfortunately it stopped working when I moved to builtin systemd
Same problem in 68.2, I'm afraid. Both, in fact - no WSL_INTEROP in the systemd or systemd user session environment, and the binfmt is lost.
The solutions provided in #5065 are a workaround for my own systemd services
Version
Microsoft Windows [Version 10.0.22000.856]
WSL Version
Kernel Version
5.15.62.1-20220921-1-microsoft-custom-WSL2+
Distro Version
Debian bookworm/sid
Other Software
No response
Repro Steps
echo $WSL_INTEROP
will return a value, such as/run/WSL/136_interop
sudo machinectl shell <username>@.host
to enter a user session under systemd.(This is used as a workaround to get a systemd user session created; see #8842 . But the same issue applies to any user session created under systemd/by non-wsl.exe means, including ssh, etc.)
echo $WSL_INTEROP
will show nothing./mnt/c/Windows/notepad.exe
Expected Behavior
The Windows application should run as normal for interop.
Actual Behavior
The Windows application fails to run and exit code 1 is returned:
Diagnostic Logs
No response