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?!
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:
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.
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.