0

If I do:

sudo systemctl --user daemon-reload 

It fails with:

Failed to connect to bus: No such file or directory 

Being the "sudo" necessary, as this belongs to a package installation.

0

1 Answer 1

0

With sudo, you're running systemctl --user as root... but if root is not logged in at the time, there is no active per-user D-Bus instance for root.

Only actual logged-in users have a user-specific D-Bus instance running. Using su or sudo may not necessarily be fully equivalent to a real login in this particular sense. If your Linux distribution has the loginctl command, use it without any parameters to see which users have active sessions (in the sense that they have an active per-user D-Bus instance).

The --global option is only meaningful with systemctl enable or systemctl disable.

If you want to run systemctl --user daemon-reload on all currently active users' sessions, you might want to do something like this:

#!/bin/sh for reloaduser in $(loginctl --no-legend list-users | awk '{print $2;}') do sudo -u $reloaduser systemctl --user daemon-reload done 
2
  • That throws "Failed to connect to bus: No such file or directory". Commented Jun 9, 2019 at 19:05
  • Using "sudo -E" it works. Commented Jun 9, 2019 at 20:09

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.