openHAB does not launch with host volume binding

  • Platform information:
    • Hardware: Rasberry arm64v8
    • OS: raspian / debian
  • openHAB version: 3.0.0 Snapshot #2050
  • Issue of the topic: openHAB does not launch with host volume binding.

When creating volumes within the docker volume, openHAB works fine and stores the configurations persistently. But as soon as I try to map or bind to /opt/openhab/ /with my non-docker openHAB config added) on the host machine for better backup accessibility (see second screenshot) the installation crashes (see log below).

  • Please post configurations (if applicable): see screenshot

2020-12-09T13:47:47.800044016Z logs,
2020-12-09T13:47:47.800065349Z mqttembedded.bin,
2020-12-09T13:47:47.800086682Z openhabcloud,
2020-12-09T13:47:47.800107626Z persistence,
2020-12-09T13:47:47.800128626Z secrets,
2020-12-09T13:47:47.800149515Z tmp,
2020-12-09T13:47:47.800170533Z uuid,
2020-12-09T13:47:47.800191755Z zwave' ']',
2020-12-09T13:47:47.800926743Z ++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties,
2020-12-09T13:47:47.803053025Z cmp: /openhab/userdata/etc/version.properties: No such file or directory,
2020-12-09T13:47:47.803389650Z + '[' '!' -z ']',
2020-12-09T13:47:47.803555647Z + chown -R openhab:openhab /openhab,
2020-12-09T13:47:50.282688275Z + sync,
2020-12-09T13:47:50.311296983Z + '[' -d /etc/cont-init.d ']',
2020-12-09T13:47:50.311408370Z + sync,
2020-12-09T13:47:50.319624614Z + '[' false == false ']',
2020-12-09T13:47:50.320348010Z ++ IFS=' ',
2020-12-09T13:47:50.320446786Z ++ echo gosu openhab tini -s ./start.sh,
2020-12-09T13:47:50.320954927Z + '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']',
2020-12-09T13:47:50.320999019Z + command=($@ server),
2020-12-09T13:47:50.321063592Z + exec gosu openhab tini -s ./start.sh server,
2020-12-09T13:47:50.327880246Z Launching the openHAB runtime...,
2020-12-09T13:47:51.519917043Z null,
2020-12-09T13:47:51.527233468Z Error occurred shutting down framework: java.lang.NumberFormatException: null,
2020-12-09T13:47:51.527696609Z java.lang.NumberFormatException: null,
2020-12-09T13:47:51.528651427Z 	at java.base/java.lang.Integer.parseInt(Integer.java:614),
2020-12-09T13:47:51.528723056Z 	at java.base/java.lang.Integer.parseInt(Integer.java:770),
2020-12-09T13:47:51.528853276Z 	at org.apache.karaf.main.ConfigProperties.<init>(ConfigProperties.java:235),
2020-12-09T13:47:51.528932071Z 	at org.apache.karaf.main.Main.updateInstancePidAfterShutdown(Main.java:227),
2020-12-09T13:47:51.529032144Z 	at org.apache.karaf.main.Main.main(Main.java:192),
2020-12-09T14:06:53.003190295Z ++ test -t 0,
2020-12-09T14:06:53.003285236Z ++ echo false,
2020-12-09T14:06:53.005227314Z + interactive=false,
2020-12-09T14:06:53.005388012Z + set -euo pipefail,
2020-12-09T14:06:53.005432548Z + IFS=',
2020-12-09T14:06:53.005458695Z 	',
2020-12-09T14:06:53.005546858Z + '[' limited = unlimited ']',
2020-12-09T14:06:53.005648540Z + rm -f /openhab/runtime/instances/instance.properties,
2020-12-09T14:06:53.008923792Z + rm -f /openhab/userdata/tmp/instances/instance.properties,
2020-12-09T14:06:53.012033606Z + NEW_USER_ID=9001,
2020-12-09T14:06:53.012125325Z + NEW_GROUP_ID=9001,
2020-12-09T14:06:53.012151379Z + echo 'Starting with openhab user id: 9001 and group id: 9001',
2020-12-09T14:06:53.012089011Z Starting with openhab user id: 9001 and group id: 9001,
2020-12-09T14:06:53.012345280Z + id -u openhab,
2020-12-09T14:06:53.017090183Z + initialize_volume /openhab/conf /openhab/dist/conf,
2020-12-09T14:06:53.017174587Z + volume=/openhab/conf,
2020-12-09T14:06:53.017298972Z + source=/openhab/dist/conf,
2020-12-09T14:06:53.017789917Z ++ ls -A /openhab/conf,
2020-12-09T14:06:53.021382010Z + '[' -z 'html,
2020-12-09T14:06:53.021479191Z icons,
2020-12-09T14:06:53.021503061Z items,
2020-12-09T14:06:53.021525042Z misc,
2020-12-09T14:06:53.021546985Z persistence,
2020-12-09T14:06:53.021568299Z rules,
2020-12-09T14:06:53.021589576Z scripts,
2020-12-09T14:06:53.021610539Z services,
2020-12-09T14:06:53.021631686Z sitemaps,
2020-12-09T14:06:53.021652556Z sounds,
2020-12-09T14:06:53.021673851Z things,
2020-12-09T14:06:53.021695387Z transform' ']',
2020-12-09T14:06:53.021829901Z + initialize_volume /openhab/userdata /openhab/dist/userdata,
2020-12-09T14:06:53.021863085Z + volume=/openhab/userdata,
2020-12-09T14:06:53.021885158Z + source=/openhab/dist/userdata,
2020-12-09T14:06:53.022157482Z ++ ls -A /openhab/userdata,
2020-12-09T14:06:53.025514676Z + '[' -z 'backup,
2020-12-09T14:06:53.025587765Z backup.properties,
2020-12-09T14:06:53.025610024Z config,
2020-12-09T14:06:53.025631005Z etc,
2020-12-09T14:06:53.025651948Z hs_err_pid524.log,
2020-12-09T14:06:53.025672948Z jsondb,
2020-12-09T14:06:53.025693817Z logs,
2020-12-09T14:06:53.025714557Z mqttembedded.bin,
2020-12-09T14:06:53.025735371Z openhabcloud,
2020-12-09T14:06:53.025756408Z persistence,
2020-12-09T14:06:53.025777296Z secrets,
2020-12-09T14:06:53.025798054Z tmp,
2020-12-09T14:06:53.025818831Z uuid,
2020-12-09T14:06:53.025839553Z zwave' ']',
2020-12-09T14:06:53.026919217Z ++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties,
2020-12-09T14:06:53.029370666Z cmp: /openhab/userdata/etc/version.properties: No such file or directory,
2020-12-09T14:06:53.029680433Z + '[' '!' -z ']',
2020-12-09T14:06:53.029857963Z + chown -R openhab:openhab /openhab,
2020-12-09T14:06:53.152170591Z + sync,
2020-12-09T14:06:53.179420720Z + '[' -d /etc/cont-init.d ']',
2020-12-09T14:06:53.179678174Z + sync,
2020-12-09T14:06:53.194581044Z + '[' false == false ']',
2020-12-09T14:06:53.194793721Z ++ IFS=' ',
2020-12-09T14:06:53.194829479Z ++ echo gosu openhab tini -s ./start.sh,
2020-12-09T14:06:53.195534158Z + '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']',
2020-12-09T14:06:53.195705299Z + command=($@ server),
2020-12-09T14:06:53.195742854Z + exec gosu openhab tini -s ./start.sh server,
2020-12-09T14:06:53.204589998Z Launching the openHAB runtime...,
2020-12-09T14:06:54.367546548Z null,
2020-12-09T14:06:54.374824471Z Error occurred shutting down framework: java.lang.NumberFormatException: null,
2020-12-09T14:06:54.375543093Z java.lang.NumberFormatException: null,
2020-12-09T14:06:54.376626388Z 	at java.base/java.lang.Integer.parseInt(Integer.java:614),
2020-12-09T14:06:54.376874212Z 	at java.base/java.lang.Integer.parseInt(Integer.java:770),
2020-12-09T14:06:54.378052873Z 	at org.apache.karaf.main.ConfigProperties.<init>(ConfigProperties.java:235),
2020-12-09T14:06:54.378385269Z 	at org.apache.karaf.main.Main.updateInstancePidAfterShutdown(Main.java:227),
2020-12-09T14:06:54.380286256Z 	at org.apache.karaf.main.Main.main(Main.java:192),

If I change the mapped volume to /home/pi/openhab - everything works fine. There must be something wrong specifically with /opt/openhab - as I am more than sure that it has the appropriate permissions.

'/openhab/dist/conf/./icons/classic' -> '/openhab/conf/./icons/classic'


'/openhab/dist/conf/./icons/classic/readme.txt' -> '/openhab/conf/./icons/classic/readme.txt'

'/openhab/dist/conf/./items' -> '/openhab/conf/./items'

'/openhab/dist/conf/./items/readme.txt' -> '/openhab/conf/./items/readme.txt'

'/openhab/dist/conf/./persistence' -> '/openhab/conf/./persistence'

'/openhab/dist/conf/./persistence/readme.txt' -> '/openhab/conf/./persistence/readme.txt'

'/openhab/dist/conf/./rules' -> '/openhab/conf/./rules'

'/openhab/dist/conf/./rules/readme.txt' -> '/openhab/conf/./rules/readme.txt'

'/openhab/dist/conf/./scripts' -> '/openhab/conf/./scripts'

'/openhab/dist/conf/./scripts/readme.txt' -> '/openhab/conf/./scripts/readme.txt'

'/openhab/dist/conf/./services' -> '/openhab/conf/./services'

'/openhab/dist/conf/./services/addons.cfg' -> '/openhab/conf/./services/addons.cfg'

'/openhab/dist/conf/./services/readme.txt' -> '/openhab/conf/./services/readme.txt'

'/openhab/dist/conf/./services/runtime.cfg' -> '/openhab/conf/./services/runtime.cfg'

'/openhab/dist/conf/./sitemaps' -> '/openhab/conf/./sitemaps'

'/openhab/dist/conf/./sitemaps/readme.txt' -> '/openhab/conf/./sitemaps/readme.txt'

'/openhab/dist/conf/./sounds' -> '/openhab/conf/./sounds'

'/openhab/dist/conf/./sounds/barking.mp3' -> '/openhab/conf/./sounds/barking.mp3'

'/openhab/dist/conf/./sounds/doorbell.mp3' -> '/openhab/conf/./sounds/doorbell.mp3'

'/openhab/dist/conf/./things' -> '/openhab/conf/./things'

'/openhab/dist/conf/./things/readme.txt' -> '/openhab/conf/./things/readme.txt'

'/openhab/dist/conf/./transform' -> '/openhab/conf/./transform'

'/openhab/dist/conf/./transform/de.map' -> '/openhab/conf/./transform/de.map'

'/openhab/dist/conf/./transform/en.map' -> '/openhab/conf/./transform/en.map'

'/openhab/dist/conf/./transform/readme.txt' -> '/openhab/conf/./transform/readme.txt'

+ initialize_volume /openhab/userdata /openhab/dist/userdata

+ volume=/openhab/userdata

+ source=/openhab/dist/userdata

++ ls -A /openhab/userdata

+ '[' -z '' ']'

+ echo 'Initializing empty volume /openhab/userdata ...'

+ cp -av /openhab/dist/userdata/. /openhab/userdata/

Initializing empty volume /openhab/userdata ...

'/openhab/dist/userdata/./etc' -> '/openhab/userdata/./etc'

'/openhab/dist/userdata/./etc/all.policy' -> '/openhab/userdata/./etc/all.policy'

'/openhab/dist/userdata/./etc/branding-ssh.properties' -> '/openhab/userdata/./etc/branding-ssh.properties'

'/openhab/dist/userdata/./etc/branding.properties' -> '/openhab/userdata/./etc/branding.properties'

'/openhab/dist/userdata/./etc/config.properties' -> '/openhab/userdata/./etc/config.properties'

'/openhab/dist/userdata/./etc/custom.properties' -> '/openhab/userdata/./etc/custom.properties'

'/openhab/dist/userdata/./etc/custom.system.properties' -> '/openhab/userdata/./etc/custom.system.properties'

'/openhab/dist/userdata/./etc/distribution.info' -> '/openhab/userdata/./etc/distribution.info'

'/openhab/dist/userdata/./etc/equinox-debug.properties' -> '/openhab/userdata/./etc/equinox-debug.properties'

'/openhab/dist/userdata/./etc/java.util.logging.properties' -> '/openhab/userdata/./etc/java.util.logging.properties'

'/openhab/dist/userdata/./etc/jmx.acl.org.apache.karaf.bundle.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.bundle.cfg'

'/openhab/dist/userdata/./etc/jmx.acl.org.apache.karaf.config.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.config.cfg'

'/openhab/dist/userdata/./etc/jre.properties' -> '/openhab/userdata/./etc/jre.properties'

'/openhab/dist/userdata/./etc/keys.properties' -> '/openhab/userdata/./etc/keys.properties'

'/openhab/dist/userdata/./etc/keystore' -> '/openhab/userdata/./etc/keystore'

'/openhab/dist/userdata/./etc/log4j2.xml' -> '/openhab/userdata/./etc/log4j2.xml'

'/openhab/dist/userdata/./etc/org.apache.aries.jax.rs.whiteboard.default.cfg' -> '/openhab/userdata/./etc/org.apache.aries.jax.rs.whiteboard.default.cfg'

'/openhab/dist/userdata/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg' -> '/openhab/userdata/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg'

'/openhab/dist/userdata/./etc/org.apache.felix.fileinstall-deploy.cfg' -> '/openhab/userdata/./etc/org.apache.felix.fileinstall-deploy.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.bundle.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.config.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.config.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.feature.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.feature.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.jaas.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.kar.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.scope_bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.scope_bundle.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.shell.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.system.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.system.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.features.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.features.repos.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.repos.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.features.xml' -> '/openhab/userdata/./etc/org.apache.karaf.features.xml'

'/openhab/dist/userdata/./etc/org.apache.karaf.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.jaas.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.kar.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.log.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.log.cfg'

'/openhab/dist/userdata/./etc/org.apache.karaf.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.shell.cfg'

'/openhab/dist/userdata/./etc/org.jupnp.cfg' -> '/openhab/userdata/./etc/org.jupnp.cfg'

'/openhab/dist/userdata/./etc/org.openhab.audio.cfg' -> '/openhab/userdata/./etc/org.openhab.audio.cfg'

'/openhab/dist/userdata/./etc/org.openhab.voice.cfg' -> '/openhab/userdata/./etc/org.openhab.voice.cfg'

'/openhab/dist/userdata/./etc/org.ops4j.pax.logging.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.logging.cfg'

'/openhab/dist/userdata/./etc/org.ops4j.pax.url.mvn.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.url.mvn.cfg'

'/openhab/dist/userdata/./etc/org.ops4j.pax.web.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.web.cfg'

'/openhab/dist/userdata/./etc/overrides.properties' -> '/openhab/userdata/./etc/overrides.properties'

'/openhab/dist/userdata/./etc/profile.cfg' -> '/openhab/userdata/./etc/profile.cfg'

'/openhab/dist/userdata/./etc/scripts' -> '/openhab/userdata/./etc/scripts'

'/openhab/dist/userdata/./etc/scripts/shell.colors.script' -> '/openhab/userdata/./etc/scripts/shell.colors.script'

'/openhab/dist/userdata/./etc/scripts/shell.completion.script' -> '/openhab/userdata/./etc/scripts/shell.completion.script'

'/openhab/dist/userdata/./etc/shell.init.script' -> '/openhab/userdata/./etc/shell.init.script'

'/openhab/dist/userdata/./etc/startup.properties' -> '/openhab/userdata/./etc/startup.properties'

'/openhab/dist/userdata/./etc/system.properties' -> '/openhab/userdata/./etc/system.properties'

'/openhab/dist/userdata/./etc/users.properties' -> '/openhab/userdata/./etc/users.properties'

'/openhab/dist/userdata/./etc/version.properties' -> '/openhab/userdata/./etc/version.properties'

'/openhab/dist/userdata/./logs' -> '/openhab/userdata/./logs'

'/openhab/dist/userdata/./logs/openhab.log' -> '/openhab/userdata/./logs/openhab.log'

'/openhab/dist/userdata/./tmp' -> '/openhab/userdata/./tmp'

'/openhab/dist/userdata/./tmp/README' -> '/openhab/userdata/./tmp/README'

++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties

+ '[' '!' -z ']'

+ chown -R openhab:openhab /openhab

+ sync

+ '[' -d /etc/cont-init.d ']'

+ '[' false == false ']'

++ IFS=' '

++ echo gosu openhab tini -s ./start.sh

+ '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']'

+ command=($@ server)

+ exec gosu openhab tini -s ./start.sh server

Launching the openHAB runtime...

Mapping /openhab causes issues because many of its sub-directories contain data that is updated with every container image. There is no need to backup all that data because it is part of the container image.

So you should really only want to map/backup these dirs in the container using volumes:

  • /openhab/addons
  • /openhab/conf
  • /openhab/userdata

That’s also why all the examples in the README use these volumes. :slight_smile:

1 Like

That is all they show mapped?

If you’ve mapped the volumes exactly like in the README then it could be a permissons problem. You could test with completely empty directories as volumes. After startup they should be initialized with the default files. If they remain empty there is most likely a permissions problem.

1 Like

They could try navigating & writing to the directories as user id 9001.

Maybe @frankie.delure can show us the output of ls -ln /opt/openhab ?

1 Like

As you can see on the screenshot I only have mapped the three folders you mention. But not as /openhab but /opt/openhab which I personally prefer.

A few horus later:

I spent now three hours to confirm that /openhab is the only path that works at least for me. Plus you need to manually update the group rights of the folders and files so that it works with or at least with parts of my current configuration. Finally I was able to have a more or less running system including frontrail.

Two learnings:

  • A painful process, lots of manual work to get an existing installation back. It wil definitely take longer before I this could be a production system for me.
  • I guess that most of start issues that some here in the forum face are related to a volume mapping that is not supported.