How to check failed to get D-Bus connection?

How to check failed to get D-Bus connection?

Failed to get D-Bus connection: No such file or directory. Check that these exists: ls -l /usr/lib/systemd/system/user {,-runtime-dir}@.service. If so, start the user manager instance for USER_UID as root: systemctl start user@USER_UID.service.

Why is systemctl failing to get a D-Bus connection?

This allowed systemd to start and launch the registered services, but systemctl was failing with the D-Bus error. For me, the missing link was the absence of the /run/systemd/system directory, discovered this by strace ing systemctl. Creating this directory manually before running systemctl allows systemctl to work-for-me.

How to get a D-Bus connection on centos7?

On Centos7 all the services are started and stopped throught the systemd daemon. The systemctl command will simply try to talk to the daemon by using a d-bus channel – and that’s where the message comes from.

Why does my-host use the user bus?

Your comment to that answer suggested that you don’t have remote login. It sounds like my-host is a system user. The reasons we’d often want to use the user bus is so that the user can control their own units with systemctl and review their own logs with journalctl.

Why is my systemctl unable to access the D-Bus?

So there’s a long standing issue where the XDG_RUNTIME_DIR environment variable doesn’t get set properly, or at all, when users log in, and therefore can’t access the user D-Bus. This happens when the user logs in via some other method than the local graphical console.

Is there a problem with the dBus connection?

It seems to be working without any issues for the root account, but I cannot access the dbus connection: systemctl –user  Failed to get D-Bus connection: No such file or directory

How to set XDG _ RUNTIME _ DIR in Pam?

I did a reinstall and everything works as expected. That could be a problem, XDG_RUNTIME_DIR should be set by systemd-logind at login through the module pam_systemd and DBUS_SESSION_BUS_ADDRESS relies on XDG_RUNTIME_DIR.