Why is `systemctl --user` broken unless I run it using `su`?
3
votes
2
answers
3020
views
In a recent Lubuntu 22.04 install, when running
systemctl --user
with user 1000 I get:
❯ systemctl status --user
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=@.host --user to connect to bus of other user)
❯ eval $(dbus-launch --sh-syntax)
❯ systemctl status --user
Failed to read server status: Process org.freedesktop.systemd1 exited with status 1
However, when using another user (1001), or the same user, via su $user
, systemctl status --user
works just fine.
Data:
- When the user 1001 has an active tty session (via su
, ls /run/user
shows 1001
and systemctl status user-1001.slice
shows it active.
- journalctl -u user-1000.slice
shows no errors.
- The problem is the same for newly created users.
- Is user 1000 is 'delta', executing su delta
(from delta's ssh session), and then systemclt --user
, all works. Somehow, su
creates the needed environment, but not ssh.
What else can I do to debug the problem? Can I restore systemd status config to a fresh state?, or copy something from 1002 to 1001?
Asked by Sebastian
(153 rep)
Feb 6, 2023, 12:07 PM
Last activity: Jan 23, 2024, 07:27 AM
Last activity: Jan 23, 2024, 07:27 AM