Failure to Upgrade v2.48.0->v2.51.1+rev2 on a fin

Had a device that was offline for a couple months and when I went back to it, and tried to upgrade the host OS:

resinhup failed: exit code 1 stderr: [000000003][ERROR]Device type sanity check failed...

This is attempting to go from balenaOS 2.48.0+rev1 to v2.51.1+rev2 on a fin.

Seems the function that does the “sanity check” looks like this:

function device_type_match {
# slug in `device-type.json` and `deviceType` in `config.json` should be always the same on proper devices`
local deviceslug
local devicetype
local match
if deviceslug=$(jq .slug "$DEVICETYPEJSON") && devicetype=$(jq .deviceType "$CONFIGJSON") && [ "$devicetype" = "$deviceslug" ]; then
    match=yes
else
    match=no
fi
echo "${match}"
}

So I took a look:

root@tcore:/mnt/boot# jq .slug device-type.json 
"fincm3"
root@tcore:/mnt/boot# jq .deviceType config.json 
"beaglebone-green-wifi"

The BBGW was the first board that I was using to start development, then I moved to the fin. So clearly this is now causing an issue.

What’s the fix?

Thanks,

A.

Hey Adam

The BBGW was the first board that I was using to start development, then I moved to the fin. So clearly this is now causing an issue.

How do you mean? Are you using the same sd card or something?

Maybe you can try to download the proper config.json from the balenaCloud dashboard? You can choose to only download the configuration file when adding a device.
Otherwise perhaps you can reflash the device if there is no crucial data on the device.

Thanks

I think the issue is the other way around Rahul: the dashboard indicates the hardware is BBGW while it is actually a fin. How can I reconcile that?

This is how it happened:

  1. I started the project with a BBGW
  2. Then I bought a Fin
  3. Added the new hardware to the existing application in balenaCloud
  4. Tried to upgrade the OS

Thanks,

A.

Hi Adam, Thanks for the extra info. Please could you clarify what steps you took in step 3?
E.g. :

Did you perform the “Add new device” step in the dashboard, and if so, did you select “Balena Fin (CM3)” from the dropdown?
Did you reuse any media from the old device, or did you reflash from scratch? Thank you

Did you perform the “Add new device” step in the dashboard, and if so, did you select “Balena Fin (CM3)” from the dropdown?

It was in May, so I’m not 100% certain about that. I seem to recall that I was unable to choose a hardware platform for an existing application, when adding a new device.

Did you reuse any media from the old device, or did you reflash from scratch?

Re-flashed from scratch.

A.

Hi Adam, The “Select device type” dropdown on the “Add new device” popup for your application should include the “Balena Fin (CM3)” device type since it is a compatible architecture with the BBGW. Are you able to download a new image of type Balena Fin and re-flash using that?

The “Select device type” dropdown on the “Add new device” popup for your application should include the “Balena Fin (CM3)” device type since it is a compatible architecture with the BBGW.

Is there a way to do this without physical access to the device? Could I just edit the config and perform the upgrade?

Thanks,

A.

Adam,

I think the short answer is no. You will need to re-provision the device with a valid config.json with the correct device type.

The long answer is that it is possible to edit some values in the config.json file on a device, but it comes with a risk of losing contact with the device:


However device type isn’t one of the fields mentioned there as editabe.

Phil

I was just looking around and found this post:

That would indicate, to me, that reflashing the device isn’t going to change the deviceType. Does that mean I will need to re-register the device completely?

Thanks,

A.

Hi Adam – I’m just taking over from my colleague after the end of their shift. Can I ask you to share the application that you’re experiencing this problem with? I want to make sure I have the right info before I answer your question.

Thanks,
Hugh

It’s application id XXXXXXX. Is that what you need?

Hi Adam – apologies, I was unclear; I need you to share the application with support. From the application window, you should see “Actions” on the left hand side; after clicking that, you should see “Grant Support Access”.

Thanks,
Hugh

Ah! Done.

Hi Adam – perfect, thanks very kindly. Looking over the application and the thread, here’s what I would suggest:

  • First, when creating a balena application, a default device type is selected; in your case, this was the Beaglebone Green Wireless. When new devices are added to the application through the “Add Device” wizard, this is the type selected by default – and when that image is downloaded and installed, this is what the device will register as. You can select different device types (as long as they’re compatible); the only downside is having to remember to do this each time. We are currently tracking an internal feature request to allow users to change the device type, but this is not yet on our roadmap.

  • Because your device is running a version of balenaOS configured as the BBGW, that’s what it has registered with our API as. We do not currently expose a way of changing this on a device.

  • The best way to ensure that you’ll be able to upgrade the OS on your Fin is to re-install the OS and re-register the device. If you use the dashboard for this, this would mean selecting the Fin when going through the “Add device” wizard. This will ensure that the device is registered with our API as the correct device type.

  • For convenience, you may wish to consider creating another application which does have the correct device; t\if you plan on adding more devices to this application, this would keep you from having to remember to select the correct device type each time.

Can you give that a try and let us know how that works for you?

Thanks,
Hugh

I believe I got myself into this situation because I used the CLI to provision the second development device.

I will re-flash in an hour, and will also create a new application as you suggested.

Thanks,

A.

I was successful in reflashing the device and all is now right with the world. Thanks!

Hello @crbn60 ,

I’m resurfacing this thread because we’ve released a relevant feature that you might find useful. You’re now able to change the device type from within the dashboard by clicking on the “Actions” dropdown menu.

Cheers,
Nico.

That’s great, thank you for letting me know.

A.