Score:0

How to debug: Failed to connect to bus: No such file or directory (systemctl --user status)?

ng flag

I am trying to run systemctl --user status from a user account in order to not run services from root.

The way I do it is as follows:

  1. loginctl enable-linger $USER
  2. export XDG_RUNTIME_DIR="/run/user/$UID"

Then when I run systemctl --user status I get the following error: Failed to connect to bus: No such file or directory

What I tried to debug this.

  1. Setting the DBUS_SESSION_BUS_ADDRESS env variable by: export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus" This did not fix it. (source)
  2. Rebooting the server after every change.
  3. Reinstalling dbus by sudo apt reinstall dbus-user-session

I also noticed that the XDG_RUNTIME_DIR directory does not exist e.g. sudo ls -l /run/user/1001

I am not sure what else to try or how to learn more about this problem in order for me to able to address it in a more informed manner.

Any info that can help me debug and understand this is very welcome.

P.S. I am running Ubuntu 20.04.5 and the problem likely happened after a sudo apt-get upgrade I ran. Before that it was working well.

Score:0
mx flag

I had the same problem, however rebooting helped. You should also know that you will need to edit the .bashrc for the user. Check out my wiki page for instructions

https://dw.exitstatus0.com/doku.php?id=wiki:systemd_user_service#troubleshooting

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.