Set wifi SSID and password offline

On a rpi zero project, I would like to use the wifi setting directly in initial image. But I’m not comfortable sending my SSID and passphrase over the internet to resin.io

Is there a way to set offline this setting by manipulating the .img file downloaded ? I’ve tried to mount the obtained resin image and looking through the partitions (mount with -o offset) I can’t find any configuration. Is there a documentation on how this works ? Is it using https://github.com/resin-io/resin-wifi-connect ?

This could be interesting to modify an image to generate images for different locations.

I was expecting to have configuration files in the /boot partition such as described here https://learn.adafruit.com/raspberry-pi-zero-creation/text-file-editing

Any chance that this might work ?

You can use the resin CLI to configure an image, once downloaded, for example by generating a configuration for your application:

$ resin config generate --app MyApp --network wifi --wifiSsid mySsid --wifiKey abcdefgh

And then you can inject that configuration into your downloaded image:

$ resin config inject my/config.json --type raspberry-pi --drive resin-myapp-2.9.7+rev1-v6.6.0.img

Thanks for the prompt response. I had to add a --output my/config.json to the “config generate” command.

One thing you have to look out for is that the wifi coordinates are duplicated, in the network/network.config and in wifiSsid and wifiKey in the json.

I’m having problems connecting the device. I am a bit suprised to see the “connectivity”: “connman” as I’ve read in the forums that connman had been replaced by NetworkManager…

I have “.” “:”, “,” and “)” characters in my wifi passphrase, would that be the problem ? Do they have to be escaped ?

Just chiming in here to say that I’ve previously had success with the steps outline here https://docs.resin.io/deployment/network/2.x/#introduction for offline editing of wifi credentials.

OK, thanks for the help. Problem solved. I had two pi zeros lying around an I “forgot” that one of them was not a pi zero W, so it didn’t connect because there was no wifi hardware. Switching them, solved it :wink: Sorry for the noise.