# automatic reboot from container offline device

**URL:** <https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367>\
**Category:** openBalena\
**Created:** [September 21, 2021, 12:04pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367 "2021-09-21T12:04:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteopeluso](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@matteopeluso](https://forums.balena.io/u/matteopeluso)\
**Post date:** [September 21, 2021, 12:04pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/1 "2021-09-21T12:04:05Z")

</div>

Hi!

Anyone has an advice on how to make an rpi3/4 automatically reboot while is offline from an ubuntu/alpine container?

Thanks 🙂  
Matteo

---

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forums.balena.io/u/TJvV)\
**Post date:** [September 21, 2021, 12:46pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/2 "2021-09-21T12:46:34Z")

</div>

Hi,

You can reboot [using a call to supervisor](https://www.balena.io/docs/reference/supervisor/supervisor-api/#post-v1reboot).

You will likely need to provide to provide your own connectivity checks.

Do be VERY careful with this, you don’t want your device to get stuck in a reboot loop, with no way recover.  
I’d suggest waiting at least 5 minutes before deciding to reboot, just so you can log in through UART or something and stop the reboot from happening so you can properly troubleshoot the device.

---

<div class="post-metadata">

**Author:** ![matteopeluso](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@matteopeluso](https://forums.balena.io/u/matteopeluso)\
**Post date:** [September 21, 2021, 12:51pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/3 "2021-09-21T12:51:13Z")

</div>

so you don’t need an internet connection to do this kind of Curl requests?

I have an offline device that each 12 hours does this kind of post request

```auto
curl -X POST --header "Content-Type:application/json" \
    "$BALENA_SUPERVISOR_ADDRESS/v1/reboot?apikey=$BALENA_SUPERVISOR_API_KEY"

```

in order to prevent long uptimes and in the case it looses its internet connection it can reboot and try again, but it doesn’t seems to work with an offline one …

Am i wrong about it then?

---

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forums.balena.io/u/TJvV)\
**Post date:** [September 21, 2021, 3:27pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/4 "2021-09-21T15:27:12Z")

</div>

Hi,

This should work for offline devices as well.  
How are you testing this?

Note that if you have multiple services running, you will need to include the appropriate label (`io.balena.features.supervisor-api`)

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [September 27, 2021, 11:58am UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/5 "2021-09-27T11:58:07Z")

</div>

@matteopeluso did this work for you?

Thank you for your help @TJvV 🙂

---

<div class="post-metadata">

**Author:** ![matteopeluso](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@matteopeluso](https://forums.balena.io/u/matteopeluso)\
**Post date:** [October 5, 2021, 1:29pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/7 "2021-10-05T13:29:42Z")

</div>

Hi! It’s seems like it worked, but even if I’ve inserted the command in a cronlog it seems like sometimes the reboot kills the device and never come back online …

---

<div class="post-metadata">

**Author:** ![ntzovanis](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ntzovanis/32/1150_2.png) [@ntzovanis](https://forums.balena.io/u/ntzovanis)\
**Post date:** [December 10, 2021, 2:42pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/8 "2021-12-10T14:42:08Z")

</div>

Hi @matteopeluso ,

Can you elaborate a bit more on this last issue? You mean that sometimes after the reboot is issued (via a supervisor call), the device doesn’t come online?

This might be because the root cause of the device going offline is not resolved by a reboot? Do you know why the device might be disconnecting at all?

Cheers,  
Nico.

---

<div class="post-metadata">

**Author:** ![matteopeluso](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@matteopeluso](https://forums.balena.io/u/matteopeluso)\
**Post date:** [December 13, 2021, 3:55pm UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/10 "2021-12-13T15:55:32Z")

</div>

Yes exactly, it seems like after the reboot is issued (via a supervisor call), the device doesn’t come online.

Any suggestion on how I could debug this ‘issue’?

Thanks  
Matteo

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [December 21, 2021, 11:43am UTC](https://forums.balena.io/t/automatic-reboot-from-container-offline-device/349367/12 "2021-12-21T11:43:30Z")

</div>

Hello @matteopeluso could you please tell us more details about how does it get offline? how is the device connected? Do you see the green LED blinking 4 times?

What supervisor version are you running?

Local Supervisor reboot does not require Internet so that may work. However depending on the connectivity issue the device has, rebooting doesn’t solve the problem.
