# How to restart the Balena device from the container itself

**URL:** <https://forums.balena.io/t/how-to-restart-the-balena-device-from-the-container-itself/351061>\
**Category:** balenaOS\
**Tags:** raspberrypi3\
**Created:** [January 24, 2022, 8:52am UTC](https://forums.balena.io/t/how-to-restart-the-balena-device-from-the-container-itself/351061 "2022-01-24T08:52:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mc1](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@Mc1](https://forums.balena.io/u/Mc1)\
**Post date:** [January 24, 2022, 8:52am UTC](https://forums.balena.io/t/how-to-restart-the-balena-device-from-the-container-itself/351061/1 "2022-01-24T08:52:31Z")

</div>

I have a raspberrypi running balenaOS. I would like to restart the device from the container itself using Python in some cases. Should I call the restart function using Python SDK for this? Or is there a better alternative?

Thanks.

---

<div class="post-metadata">

**Author:** ![ErikHH](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@ErikHH](https://forums.balena.io/u/ErikHH)\
**Post date:** [January 25, 2022, 3:43pm UTC](https://forums.balena.io/t/how-to-restart-the-balena-device-from-the-container-itself/351061/2 "2022-01-25T15:43:17Z")

</div>

Hi @Mc1,

The supervisor has a reboot endpoint on it’s API. Maybe you can try invoking that from the container. [Interacting with the balena Supervisor - Balena Documentation](https://www.balena.io/docs/reference/supervisor/supervisor-api/)

Cheers,  
Erik

---

<div class="post-metadata">

**Author:** ![Hesch](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@Hesch](https://forums.balena.io/u/Hesch)\
**Post date:** [February 18, 2022, 9:18am UTC](https://forums.balena.io/t/how-to-restart-the-balena-device-from-the-container-itself/351061/3 "2022-02-18T09:18:53Z")

</div>

You can also use dbus

```auto

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket \
  dbus-send \
  --system \
  --print-reply \
  --dest=org.freedesktop.systemd1 \
  /org/freedesktop/systemd1 \
  org.freedesktop.systemd1.Manager.Reboot

```

That’s the shell version, there’s also a Python lib for interacting with dbus. Make sure to enable it in the container

```auto
io.balena.features.dbus: '1'

```
