Problem with zwave usb device running in docker container

Using latest openhab/openhab:amd64-online docker image (openhab2 build #477) and the zwave binding. The zwave device is an aeotect z-stick gen5 usb stick. The container is started using docker-compose and the following docker-compose.yml file:

version: '2'
services:
  openhab:
    image: 'openhab/openhab:amd64-online'
    restart: always
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
      - '/etc/timezone:/etc/timezone:ro'
      - '/export/openhab2/userdata:/openhab/userdata'
      - '/export/openhab2/conf:/openhab/conf'
    ports:
      - "8080:8080"
      - "5555:5555"
    devices:
      - "/dev/ttyACM0:/dev/ttyACM0:rwm"
    command: 'server'

When started the following error is thrown by the runtime when the thing is added:

 java.lang.UnsatisfiedLinkError: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: failed to map segment from shared object

Any clues on how to resolve the issue?

The complete output when starting the container with the thing added follows:

Recreating openhab2_openhab_1
Attaching to openhab2_openhab_1
openhab_1  | + set -euo pipefail
openhab_1  | + IFS='
openhab_1  | '
openhab_1  | ++ ls -A /openhab/userdata
openhab_1  | + '[' -z 'cache
openhab_1  | deploy
openhab_1  | etc
openhab_1  | generated-bundles
openhab_1  | kar
openhab_1  | lock
openhab_1  | logs
openhab_1  | mapdb
openhab_1  | port
openhab_1  | tmp' ']'
openhab_1  | ++ ls -A /openhab/conf
openhab_1  | + '[' -z 'html
openhab_1  | icons
openhab_1  | items
openhab_1  | persistence
openhab_1  | rules
openhab_1  | scripts
openhab_1  | services
openhab_1  | sitemaps
openhab_1  | things
openhab_1  | transform' ']'
openhab_1  | + '[' server = server ']'
openhab_1  | + eval /openhab/start.sh
openhab_1  | ++ /openhab/start.sh
openhab_1  | Launching the openHAB runtime...
openhab_1  |
openhab_1  |                           __  _____    ____
openhab_1  |   ____  ____  ___  ____  / / / /   |  / __ )
openhab_1  |  / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
openhab_1  | / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
openhab_1  | \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
openhab_1  |     /_/                        2.0.0-SNAPSHOT
openhab_1  |                                Build #447
openhab_1  |
openhab_1  | Hit '<tab>' for a list of available commands
openhab_1  | and '[cmd] --help' for help on a specific command.
openhab_1  | Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab_1  |
openhab_1  | openhab> java.lang.UnsatisfiedLinkError: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: failed to map segment from shared object
openhab_1  | at java.lang.ClassLoader$NativeLibrary.load(Native Method)
openhab_1  | at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
openhab_1  | at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
openhab_1  | at java.lang.Runtime.load0(Runtime.java:809)
openhab_1  | at java.lang.System.load(System.java:1086)
openhab_1  | at gnu.io.NativeResource.loadResource(NativeResource.java:136)
openhab_1  | at gnu.io.NativeResource.inJarLoad(NativeResource.java:40)
openhab_1  | at gnu.io.NativeResource.loadLib(NativeResource.java:60)
openhab_1  | at gnu.io.NativeResource.load(NativeResource.java:28)
openhab_1  | at gnu.io.SerialManager.<init>(SerialManager.java:10)
openhab_1  | at gnu.io.SerialManager.getInstance(SerialManager.java:16)
openhab_1  | at gnu.io.RXTXCommDriver.<clinit>(RXTXCommDriver.java:87)
openhab_1  | at java.lang.Class.forName0(Native Method)
openhab_1  | at java.lang.Class.forName(Class.java:264)
openhab_1  | at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
openhab_1  | at org.openhab.binding.zwave.handler.ZWaveSerialHandler.initialize(ZWaveSerialHandler.java:79)
openhab_1  | at org.eclipse.smarthome.core.thing.internal.ThingManager$8$1.call(ThingManager.java:739)
openhab_1  | at org.eclipse.smarthome.core.thing.internal.ThingManager$8$1.call(ThingManager.java:1)
openhab_1  | at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:177)
openhab_1  | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
openhab_1  | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
openhab_1  | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
openhab_1  | at java.lang.Thread.run(Thread.java:745)
openhab_1  | java.lang.UnsatisfiedLinkError: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: /openhab/userdata/tmp/libNRJavaSerial_openhab_0/libNRJavaSerial.so: failed to map segment from shared object
openhab_1  | at java.lang.ClassLoader$NativeLibrary.load(Native Method)
openhab_1  | at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
openhab_1  | at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
openhab_1  | at java.lang.Runtime.load0(Runtime.java:809)
openhab_1  | at java.lang.System.load(System.java:1086)
openhab_1  | at gnu.io.NativeResource.loadResource(NativeResource.java:136)
openhab_1  | at gnu.io.NativeResource.inJarLoad(NativeResource.java:40)
openhab_1  | at gnu.io.NativeResource.loadLib(NativeResource.java:60)
version: '2'
openhab_1  | at gnu.io.NativeResource.load(NativeResource.java:28)
openhab_1  | at gnu.io.SerialManager.<init>(SerialManager.java:10)
openhab_1  | at gnu.io.SerialManager.getInstance(SerialManager.java:16)
openhab_1  | at gnu.io.RXTXCommDriver.<clinit>(RXTXCommDriver.java:87)
openhab_1  | at java.lang.Class.forName0(Native Method)
openhab_1  | at java.lang.Class.forName(Class.java:264)
openhab_1  | at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
openhab_1  | at org.openhab.binding.zwave.handler.ZWaveSerialHandler.initialize(ZWaveSerialHandler.java:79)
openhab_1  | at org.eclipse.smarthome.core.thing.internal.ThingManager$8$1.call(ThingManager.java:739)
openhab_1  | at org.eclipse.smarthome.core.thing.internal.ThingManager$8$1.call(ThingManager.java:1)
openhab_1  | at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:177)
openhab_1  | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
openhab_1  | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
openhab_1  | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
openhab_1  | at java.lang.Thread.run(Thread.java:745)
openhab_1  | java.lang.ExceptionInInitializerError thrown while loading gnu.io.RXTXCommDriver
openhab_1  | java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver

^CGracefully stopping... (press Ctrl+C again to force)
Stopping openhab2_openhab_1 ... done
1 Like

Have you seen this issue? https://github.com/docker/compose/issues/1339

TL;DR: /tmp needs to be executable

1 Like

Yes I had - but had discarded it my first troubleshooting attempts. Turns out the issue is the same!

I’m running the docker containers on a NAS with the OpenMediaVault distribution. The volumes mounted in the openhab container are to openmediavault shares. By design, openmediavault creates/mounts shares with the noexec flag.

Instead of remounting the share with exec rights i simply created a soft link for the userdata/tmp to the real /tmp of the NAS and is now ready to continue my migration efforts from openhab 1.7.1 (and 1.8.3) to 2.0.

Thanks Rickard for the hint.

1 Like