microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.43k stars 822 forks source link

[0.68.2] systemd user session destroys /mnt/wslg/runtime-dir #8918

Closed cerebrate closed 5 months ago

cerebrate commented 2 years ago

Version

Microsoft Windows [Version 10.0.22000.978]

WSL Version

Kernel Version

5.15.62.1-20220921-1-microsoft-custom-WSL2+

Distro Version

Debian bookworm/sid

Other Software

No response

Repro Steps

  1. Start WSL with systemd enabled.
  2. Observe that /run/user/1000 has /mnt/wslg/runtime-dir mounted over it.
  3. Start a systemd user session; for example, with systemd-machined installed, run sudo machinectl shell avatar@host

Expected Behavior

The /run/user/1000 and /mnt/wslg/runtime-dir directories should have identical contents, consisting of both user session-related and WSLg-related files and sockets.

Actual Behavior

This appears to be the result of user-runtime-dir@.service not understanding that the user directory is already a mount point.

Diagnostic Logs

No response

cerebrate commented 2 years ago

See also note to #8842.

cerebrate commented 2 years ago

As a workaround, this can be avoided by creating the following file as /lib/systemd/system/user-runtime-dir@.service.d/override.conf:

[Unit]
ConditionPathIsMountPoint=!/run/user/%i

Which will bypass attempting to create a new user runtime directory for any uids which already have one mounted.

aki-k commented 1 year ago

@cerebrate Amazing thank you very much. I had a hard time figuring this out (/mnt/wslg/runtime-dir being emptied and wayland stopping working)

microsoft-github-policy-service[bot] commented 5 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!