Reflashed local development device does not run application

Hello,

I am not sure if this post should be in balenaCloud or in balenaOS, as it has to do with both.

I use a single device (raspberry pi) to test multiple applications before deploying changes to my fleets.
This week, I noticed something peculiar while switching from one image to a different one.

  1. First I had the device running a development image of application A in local mode (Device A).
    I did some testing and everything was fine.
  2. Then I had to test some things for a different application, so I flashed a development image of application B, put it in local mode and everything was fine (Device B).
  3. After a while, I had to go back to application A, but the original SD had been lost/overwritten, so I grabbed the image of the version it was and configured it to be the same device with balena os configure <img> --device <uuid>. (Device A again)

When I booted this up, I saw something odd.
In the dashboard, the device showed up as online, running the newer version, in development local mode, but no application container.
I noticed that balena ps -a in the HostOS did not show my application container at all.
Expecting this to be due to the local mode, I tried to local push, but that gave me connection refused errors.
I did a few reboots and everything stayed the same.

Thinking local mode was breaking things, I went to the dashboard to disable it, but the dashboard told me that could only be done in development images (which it was still showing to be the current release).
Thinking somehow something else broke, I tried to update the OS to the latest version, which it did successfully, but still no application container and still no option to disable local mode.

Tracing back my steps, I noticed I had actually flashed a production image, rather than a development image.
After grabbing the latest development image and configuring the uuid my device is now running as expected.

My conclusion is that somehow switching from a development image in local mode to a production image on the device, but not in the dashboard, stopped the application container from being made.

Hey there,
When a device is in local mode, balenaOS won’t run the application containers. You can find more info on these differences here: https://www.balena.io/docs/learn/develop/local-mode/#local-mode-caveats

I think it might be indeed that when you switched to prod image, but the device was in local mode state initially, it won’t be tracking release, so no application containers were created

That’s what I thought, but seeing as local mode is for development images only, I would expect a device running a newly flashed production image to not be in local mode.

To me it seems weird that a device with a production image copies the local mode state from the dashboard, rather than the other way around.

Hey @TJvV, I understand your confusion and raised this point in our internal system. We are aware that it’s also possible to enable local mode on production OS via an API call. We would like to fix these issues and prevent the device ending in this unexpected state.

Thanks for bringing it up and the detailed writeup. Good to hear that you figured out how to resolve this already.