`systemctl --user` results in "Failed to connect to bus" in google compute instance
I'm connected to a google compute instance via ssh with Debian 9. When I try any systemctl --user ...
command (systemctl --user status
for instance) I get an error: "Failed to connect to bus: No such file or directory".
I have tried setting XDG_RUNTIME_DIR=/run/user/$(id -u) and noticed that no directory in /run/user is created.
I also installed dbus apt install dbus
and ensured dbus.service is running (it was not installed originally).
The sshd_config by default has UsePAM yes
.
Solved with:
sudo apt install --reinstall libpam-systemd
which installed new packages: dbus, libdbus-1-3
After logout/login systemctl --user status
and other "systemctl --user" commands work. No need to set "XDG_RUNTIME_DIR".