Resin application preload leaves device in unmanageable state


I was reading the blog post on advanced device provisioning ( ) and followed the directions and was able to successfully get one of our Raspberry Pi 3 devices up and running with the image, with our code pre-loaded.

I used the resin config injection to write the config.json to the card and all was good. However, in the resin dashboard, this device is showing up as having “Factory Build” and “Unknown” OS Version. IP Address, Supervisor Version are also ‘Unknown’.

It has been online 20 minutes now and no attempt to download the latest docker container (I assume because internally, the supervisor knows it is already on the latest container).

This is causing problems though, because a device on Factory Build doesn’t allow us to manage it, restart, etc. Any ideas how to correct this?


have you used the resin config inject with administrator privileges? You usually have to call this with administrator privileges (and if so, you will need to log in with sudo resin login as well). I suspect something was not injected properly in the config file.


Yes, sudo was used. The config injection seems to work as it was able to set the correct device id and wifi network on the device.

If anyone has any suggestion on what to look for on the device image, that would be helpful. I’m not sure where the build info is set and all that. But based on the fact that build and IP and everything else is “unknown” (also, logs are empty in the dashboard) I’m guessing it’s not able to talk to the supervisor but not sure.

After re-reading your response, I’m pretty sure the resin login / resin device register commands were not done with sudo. So we have potentially a situation where we are using normal non-elevated user in earlier steps and then that step using elevated permissions. I will repeat the process again using the root user for the entire flow and report back.

Seems to have the same problem.

Commands issued (all under root):

export APP_NAME=myappname
export APP_ID=123456
export API_TOKEN=mytoken

resin login --token "${API_TOKEN}"
resin os download raspberrypi3 -o resin.img --version latest

cd resin-preload
./bin/resin-preload --app ${APP_ID} --api-token "${API_TOKEN}" --img /home/aba/resin.img

Output of resin-preload:

Building preloader image...

Building Docker preloader image. [========================] 100%


Fetching container size for xxxxx [========================] 100% 
Leaving splash image alone
Expanding image size by 1.05 GiB
Expanding extended partition 4 and logical partition 6 to the end of the disk image.
Expanding ext filesystem
Using /dev/loop1
Resizing filesystem
e2fsck: File system OK
Waiting for Docker to start...
Docker started

Pulling image [========================] 100%

[OK] Done.

Register and config:
resin device register ${APP_NAME}

Registering to myapp: xxxxx

resin device rename xxxxx dev-test
resin config generate --device xxxxx --output config.json
? Network Connection wifi
? Wifi SSID my_network_ssid
? Wifi Passphrase **********
? Check for updates every X minutes 1

resin config inject config.json --type raspberrypi3
? Select the device drive /dev/disk3 (7.9 GB) - SD Card Reader

Before boot:

After boot:


Hey, I think what might be happening here is that resin config inject overwrites some settings from the preloading in the config on the image – to check that, you should be able to compare the config on the device after preloading with the one after injecting the new config.

Okay I will try that. Thanks

Can’t seem to get it working, but solution that worked for me was to preload the image and then use resin os/local configure to setup that image for that device/network and then burn it to the card. That gives expected behavior

I’m hitting the same issue as OP. I’m following the steps on the Advanced Device Provisioning blog post but am unable to preload a working build. Here’s the script that I ran:

resin os download raspberrypi -o /path/to/rpi.img --version

resin-preload --app <app-id> --img /path/to/rpi.img --api-token <api-token> --commit <commit-hash>
export APP_NAME=AppName

echo "Preprovisioning device"  
UUID=`resin device register ${APP_NAME} | awk '{ print $4 }'`  
echo "New device: ${UUID}"

echo "Setting device name"  
resin device rename ${UUID}

echo "Config generation"  
resin config generate --device ${UUID} --output config.${UUID}.json

# At this point I loaded the rpi.img image onto the SD card via Etcher

echo "Config injection, insert the SD card to configure"
sudo resin config inject config.${UUID}.json --type raspberrypi

After inserting the SD card into my Raspberry Pi and booting it up, I see it load the splash screen and nothing else happens.

Hello @tmcneal
I can’t reproduce your issue.
I just followed all the steps of your script. I used a qemux86-64 device type instead of a raspberrypi.
I ended up with the “device” connecting to the dashboard with no issues.

Can you please post the output of your script when you run it?
Are you sure the resin config inject injected the configuration to the correct sd card?
You can pass a --drive some_disk_image_or_device option to it to be sure.