# Balena Device won't come online

**URL:** <https://forums.balena.io/t/balena-device-wont-come-online/372212>\
**Category:** Product support\
**Created:** [October 3, 2024, 2:24pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212 "2024-10-03T14:24:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![balena101](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@balena101](https://forums.balena.io/u/balena101)\
**Post date:** [October 3, 2024, 2:24pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/1 "2024-10-03T14:24:53Z")

</div>

I was testing a script that turns off networking and after a timeout turns it back on, to test how some of my containers react on a network outage.

I ran ‘_nmcli_ _networking_ _ **off** _’ and after a ‘time.sleep()’, ‘_nmcli networking **on** _’ respectively.  
This worked fine for a short timeout(while device stayed in heartbeat only mode) before turning back on, however, I wanted to let the device go “Offline” before turning it back on, without realising that it **won’t** in fact turn back on!

So I manually rebooted the device, this didn’t help, I unplugged the device and plugged it back into the mains to do a power cycle, but the device has still been “Offline” since. I am confused as to how to troubleshoot this, is there any way to connect to the device locally, via USB or such, as with it being offline, I can’t connect to it to see what the issue is. Or is the only way to fix this to re-flash balenaOS onto the device?

I am curious to know whether running ‘_nmcli networking **off** _’ would normally render the balenaOS useless, or has something gone terribly wrong? I would have thought that after a reboot/power-cycle that the network services would be reset and not stay permanently off?

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [October 4, 2024, 2:09am UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/2 "2024-10-04T02:09:47Z")

</div>

Hello, it looks like `nmcli networking off` disables networking completely. So unless you’re sure that the `nmcli networking on` command actually ran, there’s likely no way to connect to the device over a network to get it back online. Perhaps you can connect via a tty/serial port or keyboard/monitor. What type of device is it and is it in development or production OS mode?  
In the future you may want to only turn off one connection at a time with `nmcli connection down networkName`. See [Network Setup on balenaOS | balena](https://docs.balena.io/reference/OS/network/)  
Also, just to clarify, balenaOS will keep running your containers while the device is offline, you just won’t be able to access it from the balenaCloud dashboard.

---

<div class="post-metadata">

**Author:** ![balena101](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@balena101](https://forums.balena.io/u/balena101)\
**Post date:** [October 4, 2024, 8:37am UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/3 "2024-10-04T08:37:51Z")

</div>

Hi, yes I think it was a bad idea from the get-go, it seemed to work for a short timeout period, however the idea was that hostOS would still be running even with the device being offline, so the script would have ran ‘_nmcli networking **on** _’ after 1260seconds or 21minutes. However, this did not happen, is it normal for networking to not reset after a reboot/power-cycle?

It is a “Raspberry Pi 5” and it is in Development OS mode.

Yes, I noticed that, which was the reasoning for trying to run this script to disable/enable networking, I had placed the script in ‘_/mnt/data_’ of the hostOS and executed it manually.

I also previously had connected it to a monitor but after the splash screen nothing would show, I did not try using a keyboard/mouse though, should I be able to get to the CLI by simply using keyboard/mouse?

Thank you for the response! 😁

---

<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:** [October 4, 2024, 10:59am UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/4 "2024-10-04T10:59:29Z")

</div>

Hello @balena101 i discussed internally with other team members and find here some comments:

- Network manager persist on disk the `nmcli networking off`, so rebooting does not bring the networking back. So we strongly recommend to stop a network name and keep Ethernet enabled (e.g.).
- You might be able to change the `config.txt` to enable serial console access. Then you might be able to log in via serial and run `nmcli networking on`.
- Alternatively, if you have a Linux machine, you might be able to mount the `state` partition of the device on your laptop and change the configuration.

Let us know if that works!

---

<div class="post-metadata">

**Author:** ![balena101](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@balena101](https://forums.balena.io/u/balena101)\
**Post date:** [October 4, 2024, 11:59am UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/5 "2024-10-04T11:59:22Z")

</div>

Hello,

Yes that was a bad decision from the get-go… 😅

I myself could not access the device as I am not in office, however someone was having a look for me, in the end we decided to re-flash the SD.

Would be interesting to try and see if it would have been possible to fix without online access to the device so that might be something I will look into just for curiosity, I will post an update about it when I get to try it out, without breaking the device again that is!

Thank you for the help on this @mpous @alanb128 😁

---

<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:** [October 4, 2024, 12:11pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/6 "2024-10-04T12:11:43Z")

</div>

Thanks! keep us posted with your research!

And let us know as well how do you test the device getting in `Offline` status and bring it back `Online` so other members from the community can test or comment. Maybe this is a good [Show and Tell](https://forums.balena.io/c/show-and-tell/92) post.

---

<div class="post-metadata">

**Author:** ![balena101](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@balena101](https://forums.balena.io/u/balena101)\
**Post date:** [October 4, 2024, 12:20pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/7 "2024-10-04T12:20:29Z")

</div>

I will do 😁

Just a quick question while we’re here, if the containers continue to run even in ‘_ **Offline** _’ mode as @alanb128 confirmed, is there a reason why a script placed in ‘/mnt/data’ would stop running after the device switches to ‘_ **Offline** _’ status, it worked fine for a short delay however, it must have stopped when the delay was 20 minutes and the device went ‘_ **Offline** _’. 😅

It was a small bash script that ran:

> nmcli networking off  
> time.sleep()  
> nmcli networking on

---

<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:** [October 4, 2024, 1:29pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/8 "2024-10-04T13:29:29Z")

</div>

@balena101 Could you please share more details of your script? or create a dummy script so we can try to reproduce?

Thanks

---

<div class="post-metadata">

**Author:** ![balena101](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@balena101](https://forums.balena.io/u/balena101)\
**Post date:** [October 4, 2024, 1:48pm UTC](https://forums.balena.io/t/balena-device-wont-come-online/372212/9 "2024-10-04T13:48:24Z")

</div>

Of course @mpous , it was very simple, possibly why it didn’t work. 😆

The script is below:

```auto
#!/bin/bash
echo "Disabling network..."
nmcli networking off  
sleep 1260
echo "Re-enabling network..."
nmcli networking on

```

I tested with a 20 second sleep cycle, and it worked perfectly, so I decided to give it a shot and set the sleep cycle to 21minutes (1260 seconds) to allow the status to change from ‘`Heartbeat only`’ to ‘`Offline`’ before it ran the ‘`nmcli networking on`’ command.  
Without realising that Network Manager will persist even after a reboot I thought this would have been my fallback in case this didn’t go as planned… 😅

I placed the script on the hostOS in ‘`/mnt/data`’ and i executed manually using `'bash <script_name>'` over SSH on the balenaDashboard.
