Configuring 4G LTE network connection

Hi,

I am trying to configure a cellular network connection. The documentation at Network Setup on balenaOS - Balena Documentation suggests adding a file in the folder /resin-boot/system-connections of the SD image. But it does not have such a folder. When I insert the SD drive to Ubuntu 22.04 host I can see in the file explorer 2 media folders - flash-rootA and flash-rootB. Under the first one, there is a folder flash-boot/system-connections. I tried to add a configuration file in that folder to provision a device with it. But in the device booted with balena OS there is not my file which was added.
So, the question is - how can I configure cellular network connection?

Hello @Ravil please check this video (from minute 47) let me know if that helps to fix your issue

In this video, it looks like the network configuration is changed in the actual device after it is provisioned.
What I need is to configure settings such as APN, user name, and password for the cellular network (4G LTE) connection, in the OS image in the USB flash disk. So no configuration change is required after the device is added to the fleet. I could not find the folder " the /resin-boot/system-connections/ directory in the .img or on SD card" in the reference documentation.

@Ravil go to the USB flash card on your laptop, can you see the directory system-connections?

If not, could you please share a screenshot of what you see?

If you can access to this, if there isn’t any file, just create a file called cellular and add this code

[connection]
id=cellular
type=gsm
autoconnect=true

[gsm]
apn=YOUR-APN-GOES-HERE

[serial]
baud=115200

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

Save the file and try to power up the device with your USB flash disk.

BTW you can find more information to set up the apn here Cellular + IoT isn't as hard as you think - balena Blog

There is a folder system-connections under the folder flash-boot. I put the config file cellular there.
There is also etc/NetworkManager/system-connections. I also copied the file there.
And also tried to create system-connections under flash-boot.
The added file cellular does not appear in the device’s resin-boot/system-connections folder no matter what I do,
Ths OS version is generic x64.

and does it work after you added the cellular profile @Ravil ?

No, does not work.
The added file cellular does not appear in the device’s resin-boot/system-connections

Could you please show me the results of nmcli d?

Note that right now SIM card is not inserted. Not sure if that plays some role.

@Ravil could you please try with the simcard?

Thanks

Hi,

Here si the screenshot with SIM card inserted:
image

If you’ve got a flash image you can add default network configurations to them with balena os configure. Download the image, then run balena os configure /path/to/image.img --fleet $FLEET_SLUG --system-connection /path/to/connection.nmconnection.

Any devices flashed with that image will automatically have that connection added. You can add multiple connections by adding more than one --system-connection argument.

Cool, I will try this, thank you, Jon!
The file format is as in the example above, right?

Yeah, its a standard Network Manager configuration file.

First I tried to set it this way in a Windows machine, but it did not work.
Then tried on the laptop with Ubuntu 22.04, and it works now, GSM is displayed as connected. And I can see its IP address in the Balena dashboard.
On the device, I don’t see the network connection configuration file in the folder /resin-boot/system-connections though.
I found it in folders /mnt/boot/system-connections and /mnt/state/root-overlay/etc/NetworkManager/system-connections and mnt/boot/system-connections.

Anyhow, the problem is resolved now, thank you for the support!

1 Like