GithubHelp home page GithubHelp logo

Comments (13)

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

@9numbernine9

Does wayland-0 exist in /run/user/$UID with version 22.10.16.0? I found that wayland-0 is missing in version 24.3.11.0 when Systemd accidentally enabled, see [this issue]

No, it doesn't.

So Wayland does not work, right? If it works, what is $XDG_RUNTIME_DIR?

from archwsl.

viruscamp avatar viruscamp commented on July 30, 2024

The root cause is Arch mounts /tmp and /run/user/1000 as tmpfs after startup, make the existing /tmp/.X11-unit/X0 and /run/user/1000/wayland-0 unavailable.

Disable tmp.mount is one useful solution, but I recommend:

$ cat /etc/tmpfiles.d/wslg.conf
# See tmpfiles.d(5) for details
# link WSLg display files after system started

# Type Path              Mode UID  GID  Age Argument
L+     /tmp/.X11-unix/X0 -    -    -    -   /mnt/wslg/.X11-unix/X0

I have no idea how to disable mounting /run/user/1000 as tmpfs, so I recommend:

$ cat ~/.config/user-tmpfiles.d/wslg.conf
# Type Path              Mode UID  GID  Age Argument
L+     %t/wayland-0      -    -    -    -   /mnt/wslg/runtime-dir/wayland-0
L+     %t/wayland-0.lock -    -    -    -   /mnt/wslg/runtime-dir/wayland-0.lock
L+     %t/pulse/native   -    -    -    -   /mnt/wslg/runtime-dir/pulse/native
L+     %t/pulse/pid      -    -    -    -   /mnt/wslg/runtime-dir/pulse/pid
L+     %t/dbus-1         -    -    -    -   /mnt/wslg/runtime-dir/dbus-1

$ systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

The root cause is Arch mounts /tmp and /run/user/1000 as tmpfs after startup, make the existing /tmp/.X11-unit/X0 and /run/user/1000/wayland-0 unavailable.

Disable tmp.mount is one useful solution, but I recommend:

$ cat /etc/tmpfiles.d/wslg.conf
# See tmpfiles.d(5) for details
# link WSLg display files after system started

# Type Path              Mode UID  GID  Age Argument
L+     /tmp/.X11-unix/X0 -    -    -    -   /mnt/wslg/.X11-unix/X0

I have no idea how to disable mounting /run/user/1000 as tmpfs, so I recommend:

$ cat ~/.config/user-tmpfiles.d/wslg.conf
# Type Path              Mode UID  GID  Age Argument
L+     %t/wayland-0      -    -    -    -   /mnt/wslg/runtime-dir/wayland-0
L+     %t/wayland-0.lock -    -    -    -   /mnt/wslg/runtime-dir/wayland-0.lock
L+     %t/pulse/native   -    -    -    -   /mnt/wslg/runtime-dir/pulse/native
L+     %t/pulse/pid      -    -    -    -   /mnt/wslg/runtime-dir/pulse/pid
L+     %t/dbus-1         -    -    -    -   /mnt/wslg/runtime-dir/dbus-1

$ systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer

Does %t refer to $XDG_RUNTIME_DIR? Also, I tried to add L+ /run/user/1000/wayland-0 - - - - /mnt/wslg/runtime-dir/wayland-0 to /etc/tmpfiles.d/wslg.conf, but it did not work, why?

Add: I added the content that links files in /mnt/wslg/runtime-dir to /etc/tmpfile.d/wslg.conf, but it did not work. Must I add the content to ~/.config/user-tmpfile.d/wslg.conf? If so, I think my workaround might be better, since it works globally, not just for one user.

from archwsl.

viruscamp avatar viruscamp commented on July 30, 2024
  1. system-tmpfiles.d and user-tmpfiles.d are different services, you cannot write conf in one file
  • /usr/lib/systemd/system/systemd-tmpfiles-setup.service
  • /usr/lib/systemd/user/systemd-tmpfiles-setup.service
  1. Writing /run/user/1000/wayland-0 to /etc/tmpfiles.d/ is useless
  • file owner and group are wrong
  • /run/user/1000/ will be remounted as tmpfs later, clear the file
  1. The only global conf location for user-tmpfiles.d is /usr/share/user-tmpfiles.d/*.conf
    but user systemd-tmpfiles-setup is not enabled by default in arch, you have to enable it for each user.

  2. this user service may work globally for each user(incomplete and untested):

$ cat /etc/systemd/user/wslg-user-runtime-dir.service
[Service]
ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024
  1. system-tmpfiles.d and user-tmpfiles.d are different services, you cannot write conf in one file

    • /usr/lib/systemd/system/systemd-tmpfiles-setup.service

    • /usr/lib/systemd/user/systemd-tmpfiles-setup.service

    1. Writing /run/user/1000/wayland-0 to /etc/tmpfiles.d/ is useless
    • file owner and group are wrong

    • /run/user/1000/ will be remounted as tmpfs later, clear the file

    1. The only global conf location for user-tmpfiles.d is /usr/share/user-tmpfiles.d/*.conf
      but user systemd-tmpfiles-setup is not enabled by default in arch, you have to enable it for each user.

    2. this user service may work globally for each user(incomplete and untested):

$ cat /etc/systemd/user/wslg-user-runtime-dir.service
[Service]
ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* /run/user/"%i

Well, I think 4 should work, because my link.conf is completely same with your wslg-user-runtime-dir.service, and I'm using it.

from archwsl.

viruscamp avatar viruscamp commented on July 30, 2024

We'd better use %t as XDG_RUNTIME_DIR

$ cat /etc/systemd/user/wslg-user-runtime-dir.service
[Service]
ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

We'd better use %t as XDG_RUNTIME_DIR

$ cat /etc/systemd/user/wslg-user-runtime-dir.service
[Service]
ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t

I've tried this, but it did not work in my link.conf. Maybe I need to export "ln -fs /mnt/wslg/runtime-dir/* "%t to a file to find out why it didn't work

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

We'd better use %t as XDG_RUNTIME_DIR

$ cat /etc/systemd/user/wslg-user-runtime-dir.service
[Service]
ExecStart = sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t

I've tried this, but it did not work in my link.conf. Maybe I need to export "ln -fs /mnt/wslg/runtime-dir/* "%t to a file to find out why it didn't work

Well, I added sh -c "echo "%t" > /home/[username]/aaa.txt" in my link.conf, and found that %t is /run.

As for your systemd-tmpfiles-setup.service, I could not even start it. When I inputed sudo systemctl start /etc/systemd/user/wslg-user-runtime-dir.service in my terminal, it told me "Failed to start etc-systemd-user-wslg\x2duser\x2druntime\x2ddir.service.mount: Unit etc-systemd-user-wslg\x2duser\x2druntime\x2ddir.service.mount not found."; when I typed sudo systemctl start wslg-user-runtime-dir.service, it said "Failed to start wslg-user-runtime-dir.service: Unit wslg-user-runtime-dir.service not found." Please tell me how to start it. Thanks 😂

from archwsl.

viruscamp avatar viruscamp commented on July 30, 2024

I guess that your /etc/systemd/system/[email protected]/link.conf is part of user init process, not a standalone user service.

User's XDG_RUNTIME_DIR is not done , when sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t executed.

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

Maybe. BTW, do you know how to start your wslg-user-runtime-dir.service?

from archwsl.

viruscamp avatar viruscamp commented on July 30, 2024
$ cat /etc/systemd/user/wslg-runtime-dir.service
[Service]
Type=oneshot
ExecStart=sh -c "ln -fs /mnt/wslg/runtime-dir/* "%t

[Install]
WantedBy=default.target

$ sudo systemctl --global enable wslg-runtime-dir
Created symlink /etc/systemd/user/default.target.wants/wslg-runtime-dir.service → /etc/systemd/user/wslg-runtime-dir.service.

from archwsl.

xuangeyouneihan avatar xuangeyouneihan commented on July 30, 2024

It works! Thank you so much!

from archwsl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.