openHAB is a stream of pure joy when it comes to debugging. Especially when all I want is a small display in the kitchen, working autonomous and without the need to restart it all the time or login to fix issues.
The latest installment of that endeavor was a black screen in the browser, with no way to even get to the usual HABpanel controls. After some debugging, it turns out that the file
/var/lib/openhab2/config/org/openhab/habpanel.config) on the openHAB server was destroyed, or more accurate: shortened to
4829 bytes. Lucky me I have this file in my Ansible playbooks, and whenever there is a change, a copy of this file is fetched to my Ansible host. From there it goes into my backups, and I can restore a couple dozen versions back, if needed. So not all is bad, but still something is not working as expected. First I installed a copy of this file from my backups - but turns out shortly later the file is shortened again. Later I figured that the file is always shortened when the openHAB service restarts. This particular instance was still running openHAB 2.4, and I used this opportunity to upgrade to 2.5, test my Playbooks (and exclude the one config file from everything) and see if the problem persists. It does. Except that after upgrading to 2.5 the file is no longer shortened to
4829 bytes, but to
Every time that happens, the file ends somewhere in the middle of the HABpanel panel configuration - and naturally the HABpanel service can no longer read that file and shows a blank screen. I would wish that it rather shows an error message, or does something useful here, but oh well.
For a while (and mostly because I was busy with other tasks) I helped myself by changing the owner of
habpanel.config and the directory this files lives in to
root:root. This threw a couple other errors into the logfile, but helped somewhat because the config file got no longer destroyed when the service restarted.
After more debugging and testing I posted on the openHAB Community forum, and one user pointed me into the right direction. The Apache Felix stuff seems to be at fault, and I had to remove this from the file. I also had to wipe another config file (
/var/lib/openhab2/etc/org.openhab.habpanel.cfg), which turned out to be more complicated: the file is recreated at some point. I poured everything into my Ansible Playbook, and this specific part is now:
First “Felix” is removed from packages, then the
felix line is removed from
habpanel.config. And finally the
habpanel.cfg is removed. Restart the openHAB service. After that I had to reinstall the panel configuration once from my backups, but ever since then this is stable. No more configuration damages.