ArchWSL icon indicating copy to clipboard operation
ArchWSL copied to clipboard

Wayland socket is missing when Systemd enabled

Open xuangeyouneihan opened this issue 3 months ago • 13 comments

IMPORTANT Please read README and Docs before creating the issue.

Please fill out the below information: Describe the issue When Systemd on my subsystem started working by accident, I found that all my GUI apps can only be opened via X11. Then I found that there was no wayland-0 in /run/user/1000. I do not know why the socket was gone, but it seems to be related to Systemd. Though I wrote a script as an alternative workaround, the problem has not been really solved. Wayland socket exists in Ubuntu WSL with Systemd running, so it does not seem to be an issue of WSL.

To Reproduce Just try to make Systemd work

Expected behavior Wayland socket exists, and GUI apps can use it.

Screenshots If applicable, add screenshots to help explain your problem.

Enviroment:

  • Windows build number: 10.0.22631.3296
  • Security Software: Windows Defender
  • WSL version 1/2: WSL2
  • ArchWSL version: 24.3.11.0
  • ArchWSL Installer type zip/appx/other clean/update: scoop/zip
  • Launcher version: 23072600

Additional context

  1. To make Systemd work, first I tried to add something to %USERPROFILE%\.wslconfig according to #356 to disable cgroups v1, but it did not work. Then I found another article and modified .wslconfig according to it, and it worked. I renamed .wslconfig to .wslconfig1 without modifying it to enable cgroups v1, and Systemd was also working somehow. But when I tried to rename .wslconfig1 back without modifying it to disable cgroups v1, backup the origional ext4.vhdx, unregister ArchWSL, and then re-install it with a new ext4.vhdx, Systemd did not work. So I actually have no idea about how to make Systemd work.
  2. Eventually, inspired by a post, I wrote a script, which links everything in /mnt/wslg to /run/user/$UID at startup, as an alternative workaround. Copy the content below and paste it to /etc/systemd/system/[email protected]/link.conf to "solve" the problem:
    [Service]
    ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* /run/user/"%i
    

xuangeyouneihan avatar Mar 25 '24 15:03 xuangeyouneihan