Issue after updating SUPERVISOR VERSION

Hi, I updated the supervisor version to the latest (12.11.42) now I can access via ssh and I saw this log

“Could not move to new release: Invalid target state.
Expecting VariableName at local.apps.959450.0.services.6957.0.environment but instead got: “” (needs to start with a letter and may only contain alphanumeric characters plus ‘_’)”

I ran the Device health check, I attached the results. I got this issue:

“balenaOS 2.x detected, but this version is not currently available in https://api.resin.io

I am not able to access via ssh. My current host OS version is Resin OS 2.15.1+rev2
db0e0337100b89a83963dd8c773a722a_checks_2022.03.21_19.20.37+0000.txt (1.1 KB)

I find there is a problem with the supervisor state

{
“local”: {
“name”: “010-002-558-7”,
“config”: {
“RESIN_HOST_CONFIG_dtoverlay”: “pi3-disable-bt”,
“RESIN_SUPERVISOR_DELTA”: “1”,
“RESIN_SUPERVISOR_NATIVE_LOGGER”: “false”,
“RESIN_HOST_CONFIG_avoid_warnings”: “1”,
“RESIN_HOST_CONFIG_disable_splash”: “1”,
“RESIN_HOST_CONFIG_dtparam”: ““i2c_arm=on”,“spi=on”,“audio=on””,
“RESIN_HOST_CONFIG_gpu_mem”: “16”,
“RESIN_HOST_FIREWALL_MODE”: “”,
“RESIN_SUPERVISOR_POLL_INTERVAL”: “900000”,
“RESIN_SUPERVISOR_DELTA_REQUEST_TIMEOUT”: “59000”
},
“apps”: {
“959450”: {
“releaseId”: 1778573,
“commit”: “7a022d655d8c662c4923170e4e693f50a423b73a”,
“name”: “OhmV2Prod”,
“services”: {
“6957”: {
“privileged”: true,
“tty”: true,
“restart”: “always”,
“network_mode”: “host”,
“volumes”: [
“resin-data:/data”
],
“labels”: {
“io.resin.features.dbus”: “1”,
“io.resin.features.firmware”: “1”,
“io.resin.features.kernel-modules”: “1”,
“io.resin.features.resin-api”: “1”,
“io.resin.features.supervisor-api”: “1”
},
“imageId”: 3550485,
“serviceName”: “main”,
“image”: “registry2.balena-cloud.com/v2/b9a6f21503606a47ab652e11ace62756@sha256:880f5342de1658d3981e5b9b24ddd08e4b917eec7a3acbd1591d6e98e0da7cbd”,
“running”: true,
“environment”: {
“BUDDY_OHM_FIRMWARE_FLASHING_APIKEY”: “CcXg8sCJSiQL358Fg0YQz2BnNwKzfMVwA/BqeR9pfD1rA58rFgHPTg==”,
“INITSYSTEM”: “on”,
“IOT_DRIVER”: “AZURE_MQTT”,
“IOT_HOST_NAME”: “ohm-ohmprod1.azure-devices.net”,
“LOG4J_CONFIGURATION_FILE”: “/app/target/log4j2-production.xml”,
“MODEM_AUTO_RESTART”: “true”,
“MODEM_PORT_NUM”: “2”,
“OHM_ENV”: “Production”,
“OHM_JAVA_OPTS”: “-Xmx512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Dnetworkaddress.cache.ttl=10”,
“OHM_LCD_BRANDING”: “Buddy Ohm v2.0”,
“OHM_LOG_LEVEL”: “INFO”,
“OHM_PI_CODE”: “{“metadata”: [“https://ohmcode.blob.core.windows.net/metadata/29349afa-97ad-431e-b9ff-ebbad76ebeba/84fd345fee2d1ec59429c0539710bd2528a5f358.json.xz”, “https://ohmcode-secondary.blob.core.windows.net/metadata/29349afa-97ad-431e-b9ff-ebbad76ebeba/84fd345fee2d1ec59429c0539710bd2528a5f358.json.xz”], “commit”: “84fd345fee2d1ec59429c0539710bd2528a5f358”}”,
“”: “”,
“IOT_ACCESS_KEY”: “Xv9mc7MBdhEDR2J/RwKGgN8sfbAFbtYEkKZ2G6e4oOc=”,
“IOT_DEVICE_ID”: “bdbdbdbd-0000-6000-8000-0100025587ff”,
“OHM_SERIAL_NUMBER”: “010-002-558-7”
}
}
},
“networks”: {},
“volumes”: {
“resin-data”: {}
}
}
}
},
“dependent”: {
“apps”: {},
“devices”: {}
}
}

device: balena dashboard

Hi, the target state you shared shows the variable "":"", which is consistent with the error you are getting. However I no longer see that variable. Did you make any changes?

I have the same problem, but with variables that contain the symbol “-”.
Deepstack uses these variables to configure: API-KEY, VISION-DETECTION, VISION-FACE etc.
I can’t set through the balena dashboard because of the same error

Hi, thank you for your feedback. At the moment we restrict on the dashboard and supervisor to the allowed characters in common shells, i.e. alphanumeric characters and the underscore. We have done some testing with reduced restrictions as we know docker doesn’t impose any, but we have found that depending on how the container is setup, it may lead to some confusing behavior. There is some details on that here Remove restrictions on docker env vars by pipex · Pull Request #1912 · balena-os/balena-supervisor · GitHub

We have an internal discussion pending on this, but this is low priority right now so we cannot provide an ETA on this change making into our platform.

What we could recommend in the meantime is adding an intermediary script as entrypoint to your container to convert variables from the dashboard supported format into the format your app requires. For instance you could add a entry.py with something like the following

# convert variables
os.environ["API-KEY"] = os.environ["API_KEY"];

# start deepstack process
subprocess.Popen(["./script.py"])