automatic reboot from container offline device


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

Thanks :slight_smile:


You can reboot using a call to supervisor.

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.

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

curl -X POST --header "Content-Type:application/json" \

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?


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)

1 Like

@matteopeluso did this work for you?

Thank you for your help @TJvV :slight_smile:

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 …

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?


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’?


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.