Preload Pi3 with device variables without internet access

I’m looking to use the balena preload command in an internet-denied environment on multiple devices. Each device should have the same image (which can be generated while connected to wifi), but have a pre-generated unique identifier provided – ideally as a device variable, but I’d be happy if there’s a workaround.

I didn’t see any way to do this - am I missing something in the docs?

Hi there,

As I understand it, you’d like to create a preloaded image that can be flashed onto multiple devices where they won’t be able to connect to the balenaCloud service.

Whilst you can’t use exactly the same image for each, what you can do (from an Internet connected machine) is:

  1. Preload a provisioning image with an application which will be used as the ‘master’ image
  2. Pre-register a UUID for each device that you’d like to provision the image on
  3. Copy the ‘master’ image, and then generate a new config for the pre-registered UUID and inject this into the copy
  4. Provision a device with the specific copy of the preloaded image

This does require that a new image with a unique config is used for each unique device, but it’s a process that’s been successfully used by customers in their manufacturing environments to preload devices before being shipped.

Unfortunately, as I’m currently looking, Github is down so I can’t give you the example I was thinking of, but you need:

  1. balena device register <App> to register a new device UUID, which will be returned when the command completes (there is also an API version here: https://www.balena.io/docs/reference/sdk/node-sdk/#balena.models.device.register)
  2. balena config generate --device <UUID> --output <UUID>.config.json to generate a new config for injecting into the copy of the preloaded image
  3. balena config inject <config> --type <deviceType> <preloadedCopiedImage> to injeect the generated config into the copy of the preloaded image

Please let us know if you’ve any further questions, or more information on what might work for you!

Best regards, Heds

1 Like

That seems like it’ll work great!

We’re tracking other IDs through our device variables (too much Theseus’ Ship), but we can update the device variable (based on the device UUID we just generated) through the resin CLI.

Thanks!