Running openHAB 2 in Docker

Hello guys,

I´ve followed the tutorial and got openhab 2.4 up and running in docker. Everything seems to run fine except those warnings/errors on each startup:

2019-10-03 11:26:18.135 [WARN ] [org.apache.felix.fileinstall        ] - /usr/share/openhab2/addons does not exist, please create it.
2019-10-03 11:26:18.163 [ERROR] [org.apache.felix.fileinstall        ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-10-03 11:26:18.164 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedServiceFactory, id=38, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.1813a014-eea4-4ad5-aa1f-e70c2be8093f

Permissions should be okay, I did:

sudo find /opt/openhab/ \( -type d -exec chmod 777 {} + \) -o \( -type f -exec chmod 777 {} + \)

to be sure. Any ideas where to start?

Thanks a lot!

Which tutorial did you follow because based on the path names I reckon you’re not using the official openHAB docker image:

Also note that the log is complaining about /var/lib/openhab2/tmp/bundles (this directory does not exist in the official openHAB docker image) while you set the permissions for /opt/openhab/.

I´ve followed the tutorial from this thread and I´m using the offical openHAB docker image.

But now I see: I copied my / userdata and my / conf folder from my Openhabian installation (without Docker). There are probably references there that I still need to change.

Thanks!

Actually, I have the same issue. Did you find the culprit?
This is actually the only item which causes some issue. Not sure though what the impact is.

When I map the folders according best practice, but still using my old conf directory mapped, the system crashes immediately.

ExecStart=/usr/bin/docker run --name=%n --net=host \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  -v /home/zotac/openhab2:/openhab/conf \
  -v /opt/openhab/userdata:/openhab/userdata \
  -v /opt/openhab/addons:/openhab/addons \
  -v /opt/openhab/.java:/openhab/.java \

result:

2019-11-12 20:04:19.537 [ERROR] [org.apache.felix.scr                ] - bundle org.apache.felix.scr:2.1.2 (39)Circular reference detected trying to get service {org.eclipse.smarthome.core.audio.AudioSink}={service.id=118, service.bundleid=116, service.scope=bundle, component.name=org.eclipse.smarthome.io.javasound.internal.JavaSoundAudioSink, component.id=6}
 stack of references: ServiceReference: {org.eclipse.smarthome.core.audio.AudioSink}={service.id=118, service.bundleid=116, service.scope=bundle, component.name=org.eclipse.smarthome.io.javasound.internal.JavaSoundAudioSink, component.id=6}
ServiceReference: {org.eclipse.smarthome.core.audio.AudioManager, org.eclipse.smarthome.config.core.ConfigOptionProvider}={service.id=120, service.bundleid=103, service.scope=bundle, defaultSink=enhancedjavasound, service.config.label=Audio, component.name=org.eclipse.smarthome.core.audio.internal.AudioManagerImpl, component.id=7, service.config.category=system, felix.fileinstall.filename=file:/openhab/userdata/etc/org.eclipse.smarthome.audio.cfg, service.pid=org.eclipse.smarthome.audio, service.config.description.uri=system:audio}

Having my mapping as follows, and using the old userdata location,

ExecStart=/usr/bin/docker run --name=%n --net=host \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  -v /home/zotac/openhab2:/openhab/conf \
  -v /var/lib/openhab2:/openhab/userdata \
  -v /opt/openhab/addons:/openhab/addons \
  -v /opt/openhab/.java:/openhab/.java \    

gets the system up and running, and as far as I can see it behaves normal. Only entries in the log files are:

2019-11-12 16:04:24.657 [ERROR] [org.apache.felix.fileinstall        ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-11-12 16:04:24.666 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedServiceFactory, id=38, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.098b1b9c-eaed-41c3-8fac-c8c88d5624c5
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles

Anyone, any idea?

Maybe search and replace works. It’s a known issue anyhow:

I have completely saved my configuration in files (things, items etc.). For me it works, if I copy only the

/conf

folder. The

/userdata

folder remains completely empty.

However, I once had to copy the folder

/userdata/etc

, because openhab would not start otherwise.

Except you are missing your imbedded persistence line mapdbb and rrd4j, and any files that individual bindings might create like the secret and uuid the cloud connector creates, zwave xml files, retained messages on the embedded MQTT broker, etc. Some actions you take in the Karaf console get saved to the files in etc as well.

If you want to actually create a full backup and not lose anything, you must include everything in userdata too except for cache and temp.

Thanks for the hint. Right now I have a very simple setup here, without zwave, mqtt and so on. With the upcoming extensions I will consider that.

I want to come back to these issues.

I’m runnung openhab2.5.2 in a docker container. When starting it up I got

[WARN ] [org.apache.felix.fileinstall ] - /usr/share/openhab2/addons does not exist, please create it.
[ERROR] [org.apache.felix.fileinstall ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?

I changed into the running container and defined the missing folders manually. After a container restart all issues have been gone. So I guess there is something missing in the docker images provided. How can this be solved?

The only thing what is still complaining is

[ERROR] [etvisu.internal.util.ClientInstaller] - webfolder /openhab/userdata/…/…/…/CometVisu/src is no directory

This seems not to cause further issues but how can this be resolved as well?

Thanks a lot in advance

Hello all

I would like to install OpenHAB2 on OpenMediaVault server using Docker and Portainer to install it.

How Can I do that?

BR

I think we need a little bit more to start with. For example, where you start. is everything ready? do you have OMV and Portainer already running ?

Hello papaPhil

Yes I have OpenMediaVault already started and Docker/Portainer already installed and functional (I installed Unifi-controller).

Next step is to install OpenHAB on OpenMediaVault but I’m not an expert of Portainer… And as Unifi-COntroller is already installed, I need to have some tweaks (as java is used by OpenHAB and Unifi-COntroller, also change the port access for OpenHAB etc…)

BR

You will get the best support by posting to an OMV or Portainer website. Very few are deploying openHAB on these platforms and pretty much all of the problems and instructions are going to be specific to OMV and Portainer, not openHAB.

Ultimately, you need to learn how to translate the Docker run command arguments to whatever OMV+Portainer require. That is all outside the scope of this forum.

Hello Rick

I was expecting that kind of response. I just tried here with the hope to find someone with the same setup as mine.

I will try on OVM and Portainer forums and cross fingers.

BR

Hi,

I have openHab in docker on OMV - but not Portainer.

My biggest problem at the moment is that I do not understand what I have to do to store the installed bindings (PaperUI) permantly. After a reboot most or all of them are gone and I have to install them again via PaperUI.

Regards

What does your docker run or docker-compose.yml look like? Do you have volumes defined for the addons, userdata and configuration folders?

Yes they are part of the host system, all folders are there after stop/start.
but in paperui the bindings are marked “instal” not “uninstal” and the items are not working.

Maybe this will help someone:


This is my own compose file with
  • persist (Postgresql)
  • monitoring(Grafana and InfluxDB)
  • tasmo management(admin and backup)
  • logging (frontail).
1 Like

I am trying to startup openhab2 in docker on my omv5 machine

I have setup a docker-compose.yml per the instructions at: https://hub.docker.com/r/openhab/openhab and https://www.openhab.org/docs/installation/docker.html

I first started up my openhab container without mapping any volumes to userdata or conf just to make sure I had my ports setup correctly. Openhab2 started up just fine and I was able to log on to on the web gui.

I then mapped my userdata and conf volumes to blank new folders. And now when I run docker-compose up I get:

docker-compose up
 ...     
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    | mmap failed for CEN and END part of zip file
openhab    | Error installing bundle listed in startup.properties with url:   mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.7 and startlevel: 1
openhab exited with code 255

My docker-compose file looks like this:
version: ‘2.2’

services:
  openhab:
    image: "openhab/openhab"
    container_name: openhab
    restart: unless-stopped
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "/opt/openhab/addons:/openhab/addons"
      - "/opt/openhab/conf:/openhab/conf"
      - "/opt/openhab/userdata:/openhab/userdata"
    environment:
      USER_ID: "1005"
      GROUP_ID: "1000"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=America/Los_Angeles"
      CRYPTO_POLICY: "limited"
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0"
      - "/dev/ttyUSB1:/dev/ttyUSB1"
    ports:
      - 8080:8080
      - 8443:8443

I have a openhab user on the host with uid and gid 1005 and 1000 respectively and the files in /opt/openhab are owned by the openhab user.

Any ideas?

After starting the docker image with mounted directories for the first time, did the directories get populated with the default content from the image?