Bindings Not Installing on Upgrade

For the second time now during an upgrade (from 5.2 milestone 2 to 5.2.0, and then from 5.2.0 to 5.2.1), my bindings have not reloaded after the upgrade, forcing me to remove all bindings from my addons.cfg file, and then re-add them in order to get my bindings (and thus things) to load. I’m running OH in a docker container using the official image (currently openhab/openhab:5.2.1-debian).

When I asked Gemini about this, it suggests that the issue is that it gets stuck between needing to load new bindings with the new upgrade, but not knowing that it needs to load bindings again because the text config file hasn’t changed. I suppose this is due to the fact that I’m a legacy OH 1.0 user who refuses to use the GUI for anything I don’t have to. Gemini suggested a couple paths forward, the most promising of which is to clear the cache/addons.config file on an upgrade. Is this something that can be implemented as part of the packaged upgrade script for us curmudgeons who insist on sticking with text configs?


(From AI:)

Option 1: Delete addons.config during container updates (Recommended)

Before starting the new container version, delete the internal runtime tracking file on your host machine:

Bash

sudo rm -f /path/to/openhab/userdata/config/org/openhab/addons.config

When openHAB starts up, it notices that addons.config is completely missing, parses conf/services/addons.cfg as a brand-new configuration, and automatically pulls down the updated bindings for the new openHAB version.

Option 2: Switch to UI-based Add-on Management (JSONDB)

openHAB’s modern configuration engine handles version migrations much better when add-ons are managed through the Main UI rather than addons.cfg.

  1. Remove all binding/add-on definitions from conf/services/addons.cfg (leave the lines commented out or blank).

  2. Install your bindings via Settings $\rightarrow$ Add-ons in the Main UI.

Add-ons installed via the UI are stored in userdata/jsondb/org.openhab.core.addon.json. During container upgrades, openHAB’s internal migration scripts automatically update the bundle version references inside JSONDB files, preventing the Karaf load failure entirely.

Option 3: Automate the Cache/Config Clear on Image Update

If you use a deployment script or Docker Compose to update openHAB, add a step to clear the internal add-on configuration cache whenever you pull a new image version:

Bash

docker stop openhab
# Remove Karaf addon cache & temp directories
sudo rm -rf /path/to/openhab/userdata/cache/*
sudo rm -rf /path/to/openhab/userdata/tmp/*
sudo rm -f /path/to/openhab/userdata/config/org/openhab/addons.config
docker start openhab

There is already a script with Docker compose to clear the cache.

update.log (2.0 KB)

Most problems after an update are due to timing of the reinstallation of the bindings/bundles. After a few minutes (and a huge error log) docker restart openhab-openhab-1 or whatever your container is called.

I have never looked into the main mechanism here, but it appears that (at least for docker), openhab would restart itself after an upgrade, i.e.

  • docker compose pull
  • docker compose up -d ← docker would restart openhab:
    • openhab stops
    • openhab starts
      • openhab restarts (not the docker container, but karaf(?) would restart by itself)

but yeah, sometimes I’d have to again manually restart it on top of the above

I didn’t try to restart this time because I quickly realized it was the same issue as last time and just updated my addons.cfg. But I’m reasonably sure I restarted my container multiple times on the last upgrade and still got no results until I updated the config to force a reinstall of the bindings. I’ll test it on the next upgrade.

One possible problem is the number of network interfaces when using docker. The time to setup mDNS stuff the binding installer fails in timeout.
Another possible problem is that if one of your binding fails to install for any reason (missing dependency for example), none are finally installed.

Thanks for pointing out the Github issue. I’ve subscribed. It seems like the same issue I’m facing.

I don’t know enough about networking to know if that might be the issue. Can we extend the timeout slightly?

I don’t think it’s a single binding failing to install becuase when I change my addons.cfg and then change it back everything works fine. So I don’t think I’m missing any dependencies.