[systemd-devel] "Failed to connect to bus: No such file or directory" when running systemd --user commands with runuser as root
Mantas Mikulėnas
grawity at gmail.com
Tue Sep 20 04:43:43 UTC 2022
Non-interactive bash invocations generally don't read ~/.bashrc and don't
pay attention to environment variables that you set there.
On Mon, Sep 19, 2022 at 9:36 PM Dave Houser <davehouser1 at gmail.com> wrote:
> I am having issues on my Ubuntu 20.04 system running systemd v245.
> When trying to run `runuser -l mruser -c "systemctl --user status
> myservice.service"` I keep getting "Failed to connect to bus: No such file
> or directory"
>
> This does not make sense to me because I have the same set up on a RHEL
> 8.4 system running systemd v239, and I dont see this issue. I can run
> systemd --user commands as root with runuser with no issues.
>
> Here is the troubleshooting I performed.
>
>
> - tried running systemctl --user status myservice.service as mruser, command
> runs with no errors.
> - I already checked loginctl for mruser, Linger=yes
> - Checked to make sure there was a systemd --user process running with
> ps
> - Logged into the user's account directly with separate ssh session,
> Then tried the same command as root in the original session, still same
> error.
> - mruser already has export XDG_RUNTIME_DIR=/run/user/$(id -u) in
> ~/.bashrc
> - Tried rebooting the system, still nothing.
> - Deployed a new instance of Ubuntu 20.04, same problem on it.
> - Already read this post
> <https://askubuntu.com/questions/1374347/error-running-systemd-as-user-failed-to-connect-to-bus-dbus-session-bus-addr>,
> was not very helpful.
>
> I made a post about this you can find it here -->
> https://askubuntu.com/questions/1430191/ubuntu-20-04-not-allowing-runuser-to-manage-systemd-user-services-failed-to?noredirect=1#comment2491580_1430191
>
> This seems like odd behavior so I am not sure why this is happening. Can
> anyone help?
>
> - Dave
>
>
>
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220920/1f37ad77/attachment.htm>
More information about the systemd-devel
mailing list