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.
-
Remove all binding/add-on definitions from
conf/services/addons.cfg(leave the lines commented out or blank). -
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