[SOLVED] Upgrade 3.4.4 -> 4.3.9 (QNAP Docker): KARAF_ETC is not valid: /openhab/userdata/etc

I’m using OpenHAB on a QNAP NAS (TS-673), via Container Station (their Docker envelope). Currently running OpenHAB 3.4.4 and I thought it’s time to upgrade. Wanted to upgrade first to 4.3.9 and make it work again, then upgrade to the latest 5.x version, assuming this is the safest way to adjust for “breaking changes”, having read the release notes.

Unfortunately, after I created and started the new OpenHAB 4.3.9, I get the error “KARAF_ETC is not valid: /openhab/userdata/etc“ which then aborts the start of the container.

This is the full log of the container start in the QNAP Container Station:

+ IFS='
        '
++ find /usr/lib/jvm -mindepth 1 -maxdepth 1 -type d
+ export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
+ JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
+ '[' unlimited = unlimited ']'
+ echo 'Configuring Java unlimited strength cryptography policy...'
Configuring Java unlimited strength cryptography policy...
+ sed -i 's/^crypto.policy=limited/crypto.policy=unlimited/' /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
+ grep -E Current:.+,cap_net_admin,cap_net_raw,.+
+ capsh --print
+ rm -f '/var/lock/LCK..*'
+ rm -f /openhab/userdata/tmp/instances/instance.properties
+ NEW_USER_ID=1004
+ NEW_GROUP_ID=1001
+ echo 'Starting with openhab user id: 1004 and group id: 1001'
Starting with openhab user id: 1004 and group id: 1001
+ id -u openhab
+ initialize_volume /openhab/conf /openhab/dist/conf
+ volume=/openhab/conf
+ source=/openhab/dist/conf
++ ls -A /openhab/conf
+ '[' -z 'html
icons
items
persistence
rules
scripts
services
sitemaps
sounds
tags
things
tmp
transform' ']'
+ initialize_volume /openhab/userdata /openhab/dist/userdata
+ volume=/openhab/userdata
+ source=/openhab/dist/userdata
++ ls -A /openhab/userdata
+ '[' -z 'html
icons
items
persistence
rules
scripts
services
sitemaps
sounds
tags
things
tmp
transform' ']'
++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties
cmp: /openhab/userdata/etc/version.properties: No such file or directory
+ '[' '!' -z ']'
+ chown -R openhab:openhab /openhab
+ sync
+ '[' -d /etc/cont-init.d ']'
+ sync
+ '[' true == false ']'
+ exec su-exec openhab tini -s ./start.sh
Launching the openHAB runtime...
KARAF_ETC is not valid: /openhab/userdata/etc

Searching the forum / internet for this, I saw some postings from 2020 with this error. There were discussions around the openhab folders, access rights and some said the userdata/conf/addons folders need to be empty on first start to avoid the issue.

I was running 3.4.4 via the 9001 user. Yes, shame on me, bad practice, but it worked. So given this error I decided to fully follow the OpenHAB guidelines, created an openhab:openhab user/group, and added their IDs to the docker parameters. Didn’t help. I manually changed ownership of the openhab folder to openhab:openhab, I made sure all files & folders inside have this ownership, didn’t change anything. I also then tried to start the 4.3.9 container with an empty folder, also didn’t change anything.

Luckily I took a backup of the old folder and could make it run with the 3.4.4 container again, so currently OpenHAB is running fine again with the (very) old container.

Any help or hint towards a solution would be much appreciated. What did I miss when I tried the upgrade?

Oh my, this is embarrassing. Problem solved, it was sitting in front of the keyboard. I managed to make a stupid mistake with the mapping of the userdata folder and didn’t see it while checking a dozen times.

The OpenHAB 4.3.9 container now started correctly. At least most data / features seem to work fine immediately, will check now if there is anything left to adjust based on the release notes.

Once everything is verified to work, I’ll upgrade to the latest 5.x version.