Failed to connect to bus: No such file or directory

I keep getting this repsonse when trying to run commands like hostname, reboot, shutdown. I’ve seen reports of this on the forum before and everyone keeps being told to just ignore it.

It’s a little hard to ignore when useing automation like Ansible as it has a return code of 1.

Is there anything that can be done to remove this error? If I physically log into the pi as the dietpi user, the shutdown command doesn’t exist, hostname works with a correct error telling me to be root, and reboot causes the error. All three don’t work via ansible though.

Is there something wrong with the dietpi user? That being said, even when using ansible as root, or sudo, it still errors.

Maybe this will explain it a bit Warning during reboot · Issue #6604 · MichaIng/DietPi · GitHub

If I’m not mistaken, installation of dbus should fix this.

1 Like

I’ll give that a try. Thanks! I’ll post back the result a little later.

I had to reflash my SD card and set AUTO_UNMASK_LOGIND=1 as I couldn’t figure out how to do it inside an OS.

Anyway, it worked fine and ansible is working great. Also, my k3s setup is working as before it couldn’t see that I had set the cgroups properly, but fixing this has made everything work ok.

Maybe it shouldn’t be masked by default?

Thanks for your help :smiley:

They are masked by design and can be unmask by user if needed.

Latest DietPi version actually installs shell functions for poweroff, reboot and halt commands to mute the error, respectively to skip the responsible dbus calls in the first place. For shutdown however not, as this is aimed to do timed/scheduled shutdowns, in case with wall messages, where dbus and logind are required.

If you want to use scheduled shutdowns and did not set AUTO_UNMASK_LOGIND=1 prior to first boot:

systemctl unmask systemd-logind
apt install dbus
systemctl start dbus systemd-logind
1 Like