Error while opening file during update

I am running Openhab 2.5.4 in a docker container on a raspberry pi 3, like this

docker run \
    --name openhab25 \
    --net=host \
    -v /etc/localtime:/etc/localtime:ro \
    -v /etc/timezone:/etc/timezone:ro \
    -v /opt/openhab25/conf:/openhab/conf \
    -v /opt/openhab25/userdata:/openhab/userdata \
    -v /opt/openhab25/addons:/openhab/addons \
    -d \
    -e USER_ID=999 \
    -e GROUP_ID=994 \
    --restart=unless-stopped \
    openhab/openhab:2.5.4

When I copy my items and sitemaps to the Raspberry Pi, like this

scp "/home/bernd/Dokumente/Raspberry Pi/Openhab/Kostal/httpbinding/Kostal.items" pi@raspberrypi:/opt/openhab25/conf/items/
scp "/home/bernd/Dokumente/Raspberry Pi/Openhab/Kostal/httpbinding/Kostal.sitemap" pi@raspberrypi:/opt/openhab25/conf/sitemaps/

Then I get there warnings in the openhab.log:

2020-05-27 14:12:53.892 [WARN ] [me.core.service.AbstractWatchService] - Error while opening file during update: /openhab/conf/items/Kostal.items
2020-05-27 14:12:54.896 [WARN ] [me.core.service.AbstractWatchService] - Error while opening file during update: /openhab/conf/items/Kostal.items
2020-05-27 14:13:09.589 [WARN ] [me.core.service.AbstractWatchService] - Error while opening file during update: /openhab/conf/sitemaps/Kostal.sitemap
2020-05-27 14:13:10.592 [WARN ] [me.core.service.AbstractWatchService] - Error while opening file during update: /openhab/conf/sitemaps/Kostal.sitemap

I have to restart the container for the sitemap to become visible in Basic UI.
Does some have an idea why I get this warnings and why I have to restart the container?

Regards
Bernd

Your files are copied with ownership and permissions for the pi user, not user 999. Consequently user 999 does not have permission to open the files. When you restart the container, the startup script checks and corrects the ownership and permissions on the files.

1 Like

Thank you for the explanation.
Can I use the user “openhab” for copying the files?
I created the user “openhab” as recommended as system user, so I doubt it can be used for that.

Or just call chown after copying the files?

Is the openhab user you created UID 999? If so your best bet is to just chown the files after the copy using openhab. If not, that user you create is essentially not doing anything because you are telling the container to run openHAB under user 999.

You could probably make that user work with scp but it would be a pain.

This is why when using openHABian it sets up SAMBA shares configured with the openhab user as the owner.

Yep, user 999 is openhab.
Thx, I will just chown the files next time :grinning: