Application default device type

Hi @thgreasi
Sorry for the delay, I just came across this again.
Right now, I cannot confirm this approach unfortunately.
I have a devices (Raspberry Pi Zero 2 W), but
/etc/os-release returns this:

ID="balena-os"
NAME="balenaOS"
VERSION="2.114.18+rev3"
VERSION_ID="2.114.18+rev3"
PRETTY_NAME="balenaOS 2.114.18+rev3"
DISTRO_CODENAME="kirkstone"
MACHINE="raspberrypi3"
META_BALENA_VERSION="2.114.18"
BALENA_BOARD_REV="693b99c"
META_BALENA_REV="0d43fec5"
SLUG="raspberrypi3"

So, the host cannot identify himself correctly. Any hints on that?

Thanks
Fritz

I tried it now manually for a device where I know it is a Zero2W.
So what I did:

curl $'https://api.balena-cloud.com/v6/device_type(slug=\'raspberrypi0-2w-64\')' | jq ".d[0].id"

=>


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   174  100   174    0     0    966      0 --:--:-- --:--:-- --:--:--  1000
207

So I assume “207” is the device id.

Then I run:

curl $'https://api.balena-cloud.com/v6/device(uuid=\'<DEVICE_UUID>\')' \
  -X 'PATCH' \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'content-type: application/json' \
  --data-raw '{"is_of__device_type": 207}'

with deviceUUID and Token filled out, but I get this response:

"It is necessary that each release that should manage a device that is of a device type1, belongs to an application that is public and is not host and has a slug that is equal to \"balena_os/aarch64-supervisor\" or \"balena_os/amd64-supervisor\" or \"balena_os/armv7hf-supervisor\" or \"balena_os/i386-supervisor\" or \"balena_os/i386-nlp-supervisor\" or \"balena_os/rpi-supervisor\" and is for a device type2 that is of a cpu architecture that is supported by the device type1."%  

Any further hints / solutions @thgreasi ?

Thanks
Fritz

Hi @fritz ,

An unstable/unsupported but at the moment working way to avoid the error that you are getting, is to unpin the target Supervisor and OS release of the device.
You can do so with something like:

curl $'https://api.balena-cloud.com/v7/device(uuid=\'<DEVICE_UUID>\')' \
  -X 'PATCH' \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'content-type: application/json' \
  --data-raw '{ "should_be_managed_by__release": null, "should_be_operated_by__release": null }'

curl $'https://api.balena-cloud.com/v7/device(uuid=\'<DEVICE_UUID>\')' \
  -X 'PATCH' \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'content-type: application/json' \
  --data-raw '{"is_of__device_type": <DEVICE_TYPE_ID_OF_FLASHED_OS_IMAGE> }'
2 Likes

Thanks @thgreasi !