openhab / openhab-docker

Repository for building Docker containers for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
209 stars 128 forks source link

Runnig container with 4.0.0 snapshot results in exception #421

Closed B0rner closed 4 months ago

B0rner commented 1 year ago

Summary

I tried runnig the OH docker container with snapshot tag (4.0.0) on an synology nas. I used the same setting from OH 3.2 container including same shared folders with same rights. The startup process stops at the following error:

+ IFS='
    '
+ '[' limited = unlimited ']'
+ rm -f /openhab/runtime/instances/instance.properties
+ rm -f /openhab/userdata/tmp/instances/instance.properties
+ NEW_USER_ID=9001
+ NEW_GROUP_ID=9001
+ echo 'Starting with openhab user id: 9001 and group id: 9001'
Starting with openhab user id: 9001 and group id: 9001
+ id -u openhab
+ initialize_volume /openhab/conf /openhab/dist/conf
+ volume=/openhab/conf
+ source=/openhab/dist/conf
++ ls -A /openhab/conf
+ '[' -z 'automation
html
icons
items
misc
persistence
rules
scripts
services
sitemaps
sounds
things
transform' ']'
+ initialize_volume /openhab/userdata /openhab/dist/userdata
+ volume=/openhab/userdata
+ source=/openhab/dist/userdata
++ ls -A /openhab/userdata
+ '[' -z 'backup
cache
config
etc
jsondb
logs
persistence
secrets
tmp' ']'
++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties
+ '[' '!' -z '/openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties differ: byte 101, line 3' ']'
+ echo 'Image and userdata versions differ! Starting an upgrade.'
+ tee /openhab/userdata/logs/update.log
Image and userdata versions differ! Starting an upgrade.
++ date +%FT%H-%M-%S
+ backup_file=userdata-2023-06-11T13-51-12.tar
+ '[' '!' -d /openhab/userdata/backup ']'
+ tar --exclude=/openhab/userdata/backup -c -f /openhab/userdata/backup/userdata-2023-06-11T13-51-12.tar /openhab/userdata
tar: Removing leading `/' from member names
+ tee -a /openhab/userdata/logs/update.log
+ echo 'You can find backup of userdata in /openhab/userdata/backup/userdata-2023-06-11T13-51-12.tar'
You can find backup of userdata in /openhab/userdata/backup/userdata-2023-06-11T13-51-12.tar
+ tee -a /openhab/userdata/logs/update.log

  Warning:  Netatmo Binding: New scope has been added for the introduction of the Carbon Monoxide Alarm. Authorization process has to be replayed (and former refreshToken can be removed from things config files -- see above).
  Warning:  Windcentrale Binding: The binding has been reworked to support the new API that requires authentication. Delete old 'mill' Things, add an 'account' Bridge and add new 'windmill' Things using the 'account' as Bridge. The channel names now follow the naming conventions. Items must be adapted for these changes.
Replacing userdata system files with newer versions...
Clearing cache...
Performing post-update tasks for version 3.3.0:
Performing post-update tasks for version 3.4.0:
Starting JSON database update...
[main] INFO org.openhab.core.tools.internal.Upgrader - Already executed 'itemCopyUnitToMetadata' on 2023-06-11T13:47:45.190311544+02:00[Europe/Berlin]. Use '--force'  to execute it again.
[main] INFO org.openhab.core.tools.internal.Upgrader - Already executed 'linkUpgradeJsProfile' on 2023-06-11T13:47:45.232309520+02:00[Europe/Berlin]. Use '--force'  to execute it again.
JSON database updated successfully.
SUCCESS: openHAB updated from 3.2.0 to 4.0.0-SNAPSHOT
+ chown -R openhab:openhab /openhab
+ sync
+ '[' -d /etc/cont-init.d ']'
+ sync
+ '[' true == false ']'
+ exec gosu openhab tini -s ./start.sh
Launching the openHAB runtime...

                           _   _     _     ____  
   ___   ___   ___   ___  | | | |   / \   | __ ) 
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ 
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ 
       |_|       4.0.0-SNAPSHOT - Build #3491

Use '<tab>' for a list of available commands

and '[cmd] --help' for help on a specific command.

To exit, use '<ctrl-d>' or 'logout'.

~                                                                               

openhab> 

~                                                                               

openhab> java.io.IOException: Permission denied
    at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.base/java.io.File.createNewFile(File.java:1043)
    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:311)
    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:173)
    at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.installConfigs(BundleInstallSupportImpl.java:301)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installConfigs(FeaturesServiceImpl.java:1185)
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:961)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

The same setting and same volumes works fine with OH3.

Expected Behavior

OH4 starts using the OH3 configuration.

Current Behavior

OH4 stops during startup with the error shown above.

Possible Solution

Steps to Reproduce

  1. runnig an small OH3 installation in docker on an synology nas
  2. changing the image in docker configuration from openhab:latest to openhab:snapshot
  3. start the container

Context

I'm not sure, if this is an openhab-docker issue or an openhab-[something else] isseue

Your Environment

A synology NAS with intel x64 CPU and 2 GB of RAM.

Image

Docker Host

Configuration

[...]
"image" : "openhab/openhab:snapshot",
   "is_ddsm" : false,
   "is_package" : false,
   "links" : [],
   "memory_limit" : 1473249280,
   "name" : "openhab3.2",
   "network" : [
      {
         "driver" : "host",
         "name" : "host"
      }
   ],
   "network_mode" : "host",
   "port_bindings" : [],
   "privileged" : false,
   "shortcut" : {
      "enable_shortcut" : false,
      "enable_status_page" : false,
      "enable_web_page" : false,
      "web_page_url" : ""
   },
   "use_host_network" : true,
   "volume_bindings" : [
      {
         "host_volume_file" : "/docker/openhab/Berlin",
         "mount_point" : "/etc/localtime",
         "type" : "ro"
      },
      {
         "host_volume_file" : "/docker/openhab/timezone",
         "mount_point" : "/etc/timezone",
         "type" : "ro"
      },
      {
         "host_volume_file" : "/docker/openhab/addons",
         "mount_point" : "/openhab/addons",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/docker/openhab/conf",
         "mount_point" : "/openhab/conf",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/docker/openhab/userdata",
         "mount_point" : "/openhab/userdata",
         "type" : "rw"
      }
wborn commented 1 year ago

Works fine for me.

Maybe you can double check that files can be created in the /openhab/userdata/config dir in the container?

You can also reconfigure the FeatureConfigInstaller logger to see logging about what file it is creating by adding this to log4j2.xml:

<Logger level="DEBUG" name="org.apache.karaf.features.internal.service.FeatureConfigInstaller"/>
stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.