# Failed to connect to bus: No such file or directory

**URL:** https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120
**Category:** General Discussion
**Created:** [13 October 2023 16:30 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120 "2023-10-13T16:30:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![designermonkey](https://dietpi.com/forum/user_avatar/dietpi.com/designermonkey/32/4558_2.png) [@designermonkey](https://dietpi.com/forum/u/designermonkey)
#### Post date: [13 October 2023 16:30 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/1 "2023-10-13T16:30:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [13 October 2023 16:45 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/2 "2023-10-13T16:45:14Z")

</div>

Maybe this will explain it a bit [Warning during reboot · Issue #6604 · MichaIng/DietPi · GitHub](https://github.com/MichaIng/DietPi/issues/6604#issuecomment-1709170501)

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

---

<div class="post-metadata">

### Author: ![designermonkey](https://dietpi.com/forum/user_avatar/dietpi.com/designermonkey/32/4558_2.png) [@designermonkey](https://dietpi.com/forum/u/designermonkey)
#### Post date: [14 October 2023 10:04 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/3 "2023-10-14T10:04:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![designermonkey](https://dietpi.com/forum/user_avatar/dietpi.com/designermonkey/32/4558_2.png) [@designermonkey](https://dietpi.com/forum/u/designermonkey)
#### Post date: [14 October 2023 14:57 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/4 "2023-10-14T14:57:54Z")

</div>

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 😃

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [14 October 2023 15:57 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/5 "2023-10-14T15:57:24Z")

</div>

> [@designermonkey](#):
>
> Maybe it shouldn’t be masked by default?

> <https://github.com/MichaIng/DietPi/blob/fb0db339f63275d8924b80db7bca2d8d0410e6a0/dietpi.txt#L59C7-L59C7>

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

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [14 October 2023 21:20 UTC](https://dietpi.com/forum/t/failed-to-connect-to-bus-no-such-file-or-directory/18120/6 "2023-10-14T21:20:22Z")

</div>

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:

```sh
systemctl unmask systemd-logind
apt install dbus
systemctl start dbus systemd-logind

```
