Adding connections to network manager in the field

Hey all,

I shipped a bunch of devices with the wrong connection files in the resin-data partition.

To hack them into working with new connections in the field, I found where all the connection file live:
find / -name "resin-wifi-01"

3 things will show up:
where things are running from now linked with the one below
where you can edit things, seem like this is
-where things are loaded when you flash it in person, and I wish I could put them in the field

Then I was just let shove some files in there and see what happens with:

echo "[connection]

blah blah blah sercrets sssssshhhhhhhhhhh
" >> /mnt/state/root-overlay/etc/NetworkManager/system-connections/client_connection

Then I confirm with: cat /mnt/state/root-overlay/etc/NetworkManager/system-connections/client_connection

All this was only possible because I had the client put up a new network with the creds the devices shipped with. I put two profiles, one for use and one I could have an installer set up in a pinch without sharing client secrets.

I am worried that an OS update will wipe these new profiles and was wondering if there was a more permanent way to put things in place. I know there is a DBUS API, and if I have to explore that route I will but I don’t understand how that is more permanent unless that depends on my container updating the connections every time which is not a good solution for me.

If I have to do this in the future I would rather have a script do this thru the balena api interface.

How badly did I hurt my future self? :slight_smile:
Will OS updates roll out automatically?


Hi, should you need to change connection on-the-fly, you can safely create/modify the file(s) in /etc/NetworkManager/system-connections/ then copy it over to /mnt/boot/system-connections, OS updates should preserve those changes as well :slight_smile: you’ll just need to reboot the device after the change

I am slightly amazed at the things I miss that seem so obvious after.

Thanks for that, for some reason I was under the impression I couldn’t cp to mnt/boot/system-connections

I just confirmed that this does work.


I can assure you that you’re not the only one to whom this happens!
No problem :slight_smile: