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 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’
When the container starts it looks in the userdata folder and if it doesn’t see the right file (I think it looks for etc/versions.properties if I recall correctly). If that file doesn’t exist it is supposed to copy over a default set of all the config files needed to run OH. Did the container add anything to your mapped in userdata folder?
This is what was created :
/opt/openhab/userdata/cache:
total 12
drwxr-sr-x 3 openhab openhab 4096 Oct 5 21:58 .
drwxr-sr-x 6 openhab openhab 4096 Oct 5 21:58 …
drwxr-sr-x 3 openhab openhab 4096 Oct 5 21:58 org.eclipse.osgi
I even tried starting up the container without any mapped volumes, copied what was in /openhab/userdata and config out of the volume in into the host directories of /opt/userdata and config.
When I tried to bring up the contain like that it went into some loop with a line about mmap error.
I just tried to change my host volumes from being on my /opt folder to another location on another hard drive and the container started up!
The only difference is that the /opt folder sits on an encrypted luks drive in a mergefs (aka unionfs) ext4 file system. Whereas the new location I tried is on an unencrypted ext4 partition on an external USB hard drive.
Is the openhab container trying to do something low level to the disk that it would care about where the host volume data is mounted?
I have a half dozen other containers mounting/mapping volumes to /opt without any problems. That is very strange. I would prefer to keep openhab’s data in /opt. Any ideas what might be happening?
I figured out what was happening with the docker installation.
Openhab cannot be installed a mergerfs/union file system because they mount options for those file systems in fstab that default to cache.files=off. Openhab uses mmap functions which need cache file memory mapping to work. You would have to set it to cache.files=partial but this would slow down your system because of double buffering on the real path and the mergerfs path.
So it is best to just install the docker container on a non-mergerfs mount path.