Skip to content

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

Closed

Description

Version

Microsoft Windows [Version 10.0.22000.978]

WSL Version

  • WSL 2
  • WSL 1

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

  • The /run/user/1000 directory now has only contents belonging to the user session, and none of those pertaining to WSLg.
  • The /mnt/wslg/runtime-dir directory is now empty.

This appears to be the result of [email protected] not understanding that the user directory is already a mount point.

Diagnostic Logs

No response

Activity

  1. cerebrate commented on Sep 29, 2022

    @cerebrate
    Author

    See also note to #8842.

  2. changed the title [-]systemd user session destroys /mnt/wslg/runtime-dir[/-] [+][0.68.2] systemd user session destroys /mnt/wslg/runtime-dir[/+] on Sep 29, 2022
  3. cerebrate commented on Sep 29, 2022

    @cerebrate
    Author

    As a workaround, this can be avoided by creating the following file as /lib/systemd/system/[email protected]/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.

  4. aki-k commented on May 24, 2023

    @aki-k

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

  5. jacob-keller commented on Sep 5, 2025

    @jacob-keller

    For anyone that ran into this issue, I had something similar happen where the wslg bind remount of /run/user/1000 was being done after my systemd-user service started. I fixed this by adding an override with

    [Unit]
    Requires=run-user-%i.mount
    

    This forced the user service to start after the mount point, which allows systemctl --user to work, and appears to also work with wslg (both the regular files and the wayland socket appear, and all the contents are the same as the /mnt/wslg/run/user/1000.

    Hope this helps anyone else, as I struggled with this for several days. Many other suggested fixes failed to work while preserving GUI application support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions