Balena os configure wifi from non-interactively

I’m trying to create a script to automatically download and configure an image for an application, the steps are:

  1. Download and unzip the image file
  2. Generate configuration for the application
  3. run balena os configure balena.img --app <app name> --config <config.json>

This script runs fine, except the resulting image does not contain NetworkManager configuration in system-connections folder. The WiFi configuration is present in the config.json file, though.

The command I use to generate config is:
balena config generate --app $BALENA_APP --version $BALENA_VERSION --network wifi --wifiSsid $WIFI_SSID --wifiKey $WIFI_PSK --appUpdatePollInterval 10 -o $CONFIG_NAME

When I interactively run balena os confgure and select WIFI as network mode, then it generates NetworkManager configuration too.

So the main question is: will this device boot and connect to WiFi if config.json does contain wifi information, but NetworkManager configuration is missing? Or should I do something differently to get non-interactive wifi configuration working?

Hi @borgand

Thanks for letting us know. I haven’t actually tried generating a Wifi configuration myself, but will quickly do so and get back to you. I would imagine that if the config generation allows wifi credentials then it should build you an appropriate NM config on boot, but I’ll get back to you shortly.

Best regards, Heds

Hi again,

I’m able to reproduce what you see, and I believe that without an active NetworkManager configuration the device won’t connect. I’m engaged in conversation with the engineer responsible for the CLI at the moment, and will get back to you when we have more information, but this is looking like a bug presently.

Best regards,


Hello there,

So yes, you’ve found a problem with balenaCLI! The relevant issue is here:

Unfortunately, this means you’ll need to interactively configure the image once downloaded instead of generating a new configuration and configuring the image with it. When this issue is fixed, we’ll update this thread and let you know. Apologies for the inconvenience this currently causes.

Best regards,