Re: systemd user instance not working in only one account, XDG_RUNTIME_DIR not being set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 11, 2023, 03:41 Chandler <admin@xxxxxxxxxxxxxxxxxx> wrote:
systemd has been working great here, system-wide as well as in all user
instances except one.  I'm not exactly sure what all the steps are in
the process to get a systemd user instance running.  The directory
/run/user/$UID was not being created, though.

I made some progress by running `systemctl start
user@<username>.service` and the /run/user/$UID was created.

`systemctl --user status` returns `Failed to connect to bus: No such
file or directory`.  XDG_RUNTIME_DIR is not being set, but a command
like `XDG_RUNTIME_DIR=/run/user/$UID systemctl --user status` runs
successfully, so I think it's down to this last piece.

The same pam_systemd module registers a "session" with logind (which triggers the creation of runtime directory as well as the startup of user@<uid>.service; note: not user@<username>) and sets XDG_RUNTIME_DIR after the session has been registered. Check whether your tty or display is shown in the `loginctl` session list.

Note that logind does not allow registering sessions from within another session, so tools like `su` won't be able to do that (except for some situations where they can but you wouldn't want them to) – only a fresh login gets you a session. So usually step 1 is to not use `su` or `sudo` here – run `machinectl shell foo@` if you need a shell for a local user.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux