Docker Restarting: KARAF_ETC is not valid: /openhab/userdata/etc

There is no script on the Docker website. Just tagged containers. I have been testing the latest 2.5.7 version on Debian 10 with no issues.

In fact, I just installed it fresh a minute ago.Perhaps you got a bad download? Try stopping & uninstalling the container

docker stop openhab
docker system prune --all

And then run docker-compose again to download a fresh copy.

1 Like

I’ve tried that and I’m still getting the same thing. Also tried it in a Debian VM and RPi and I get the same thing.

openhab        | + initialize_volume /openhab/conf /openhab/dist/conf
openhab        | + volume=/openhab/conf
openhab        | + source=/openhab/dist/conf
openhab        | ++ ls -A /openhab/conf
openhab        | + '[' -z '' ']'
openhab        | + echo 'Initializing empty volume /openhab/conf ...'
openhab        | + cp -av /openhab/dist/conf/. /openhab/conf/
openhab        | Initializing empty volume /openhab/conf ...
openhab        | '/openhab/dist/conf/./html' -> '/openhab/conf/./html'
openhab        | '/openhab/dist/conf/./html/index.html' -> '/openhab/conf/./html/index.html'
openhab        | '/openhab/dist/conf/./html/readme.txt' -> '/openhab/conf/./html/readme.txt'
openhab        | '/openhab/dist/conf/./icons' -> '/openhab/conf/./icons'
openhab        | '/openhab/dist/conf/./icons/classic' -> '/openhab/conf/./icons/classic'
openhab        | '/openhab/dist/conf/./icons/classic/readme.txt' -> '/openhab/conf/./icons/classic/readme.txt'
openhab        | '/openhab/dist/conf/./items' -> '/openhab/conf/./items'
openhab        | '/openhab/dist/conf/./items/readme.txt' -> '/openhab/conf/./items/readme.txt'
openhab        | '/openhab/dist/conf/./persistence' -> '/openhab/conf/./persistence'
openhab        | '/openhab/dist/conf/./persistence/readme.txt' -> '/openhab/conf/./persistence/readme.txt'
openhab        | '/openhab/dist/conf/./rules' -> '/openhab/conf/./rules'
openhab        | '/openhab/dist/conf/./rules/readme.txt' -> '/openhab/conf/./rules/readme.txt'
openhab        | '/openhab/dist/conf/./scripts' -> '/openhab/conf/./scripts'
openhab        | '/openhab/dist/conf/./scripts/readme.txt' -> '/openhab/conf/./scripts/readme.txt'
openhab        | '/openhab/dist/conf/./services' -> '/openhab/conf/./services'
openhab        | '/openhab/dist/conf/./services/addons.cfg' -> '/openhab/conf/./services/addons.cfg'
openhab        | '/openhab/dist/conf/./services/readme.txt' -> '/openhab/conf/./services/readme.txt'
openhab        | '/openhab/dist/conf/./services/runtime.cfg' -> '/openhab/conf/./services/runtime.cfg'
openhab        | '/openhab/dist/conf/./sitemaps' -> '/openhab/conf/./sitemaps'
openhab        | '/openhab/dist/conf/./sitemaps/readme.txt' -> '/openhab/conf/./sitemaps/readme.txt'
openhab        | '/openhab/dist/conf/./sounds' -> '/openhab/conf/./sounds'
openhab        | '/openhab/dist/conf/./sounds/barking.mp3' -> '/openhab/conf/./sounds/barking.mp3'
openhab        | '/openhab/dist/conf/./sounds/doorbell.mp3' -> '/openhab/conf/./sounds/doorbell.mp3'
openhab        | '/openhab/dist/conf/./things' -> '/openhab/conf/./things'
openhab        | '/openhab/dist/conf/./things/readme.txt' -> '/openhab/conf/./things/readme.txt'
openhab        | '/openhab/dist/conf/./transform' -> '/openhab/conf/./transform'
openhab        | '/openhab/dist/conf/./transform/de.map' -> '/openhab/conf/./transform/de.map'
openhab        | '/openhab/dist/conf/./transform/en.map' -> '/openhab/conf/./transform/en.map'
openhab        | '/openhab/dist/conf/./transform/readme.txt' -> '/openhab/conf/./transform/readme.txt'
openhab        | + initialize_volume /openhab/userdata /openhab/dist/userdata
openhab        | + volume=/openhab/userdata
openhab        | + source=/openhab/dist/userdata
openhab        | ++ ls -A /openhab/userdata
openhab        | + '[' -z logs ']'
openhab        | ++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties
openhab        | cmp: /openhab/userdata/etc/version.properties: No such file or directory
openhab        | + '[' '!' -z ']'
openhab        | + chown -R openhab:openhab /openhab
openhab        | + sync
openhab        | + '[' -d /etc/cont-init.d ']'
openhab        | + sync
openhab        | + '[' false == false ']'
openhab        | ++ IFS=' '
openhab        | ++ echo gosu openhab tini -s ./start.sh
openhab        | + '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']'
openhab        | + command=($@ server)
openhab        | + exec gosu openhab tini -s ./start.sh server
openhab        | Launching the openHAB runtime...
openhab        | KARAF_ETC is not valid: /openhab/userdata/etc

There’s also a few lines of text about this and other common issues in the documentation that may help.

2 Likes

Thanks a lot for that. I’ve gone through everything again and realised that by mapping teh above for logs I’m introducing a new folder that the OH image is not expecting and fails.

Surely this is a bug and some logic could be introduced to overcome these things so that the image is not so sensitive?!

If the user does not follow the documentation and permit proper permissions, the user IS the bug.

That’s how Docker volumes are initialized by default. If there is any data in the volume it is used. If there is no data, the volume is initialized with the initial data.

Just to add some details. I don’t think that it is an issue that the image doesn’t expect that folder to be mapped in. The problem is the user that openHAB runs as inside the container doesn’t have permission to read/write to that folder. There is nothing that could be done inside the image to address this. This is a case where you, as the user, need to have a bit deeper of an understanding on how Docker and Linux works.

If you want to deviate from the default instructions where you map the whole userdata folder into the container by mapping each individual subfolder isntead that’s perfectly fine and doable. You just have to get the file/folder permissions right.

hi @rlkoshak
The logs folder was being mounted as a folder within userdata with the account being passed to OpenHAB in the environment (UID and GUID 2022) having full rw access to both userdata and the logs folder the only thing that is different to what is “expected” is that the container was started with the following empty folders with full permissions:

/openhab/userdata
/openhab/userdata/logs
/openhab/addons

It seems to be expecting just
/openhab/userdata
/openhab/addons

Why does the mere existence of an empty folder under “userdata” called “logs” cause a problem given that the permissions are correct?

This is perhaps were my understanding of Docker and the way the image interacts with it is lacking.

The entrypoint script probably tries to create the logs folder and because it already exists fails to do so. This would only be a problem the very first time the container starts with an empty userdata folder. Each subsequent start of a container with that userdata folder will see that it’s already populated and not try to create folders that already exists.

This should be fixable in the script but I question whether it’d be worth the effort. It’s an error that only occurs under this exact situation which should not be a problem when following the instructions. But I know that a PR would appreciated if one were submitted.

Hey, I see the same error on my new installation, but the problem was that /openhab/userdata was a non-empty dir… so, first, cleanup the dir. Another problem can be permissions on /openhab/userdata, because when its run, checks the version installed:

++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties
cmp: /openhab/userdata/etc/version.properties: No such file or directory

If this file above don’t exist, you have a dirty or not finished initial setup.

I hope this can help :slight_smile:

That did the trick! Thank´s a lot! Otherwise the container won´t start…

1 Like

What works for me, when I encounter this error was explicitly setting the same permissions as Openhab does during init:
(chown ommited)

sudo chmod -R 755 openhab/userdata 
sudo chmod -R 755 openhab/conf

This is somewhat strange as the folders had less restrictive permissions before(777+). It looks like the init script or one of it’s components checks for this explicit mask and fails if is not exactly 755.