SystemInfo initialization error on a docker arm64v8 container

when install the systeminfo binding, I got this error (docker, 2.3.0-arm64-debian version)

[ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.systeminfo.handler.SysteminfoHandler@f9139f': Unable to load library 'udev': Native library (linux-arm/libudev.so) not found in resource path (/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.5.jar:/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.5.jar:/openhab/runtime/lib/boot/org.apache.karaf.main-4.1.5.jar:/openhab/runtime/lib/boot/org.osgi.core-6.0.0.jar)

java.lang.UnsatisfiedLinkError: Unable to load library 'udev': Native library (linux-arm/libudev.so) not found in resource path (/openhab/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.5.jar:/openhab/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.5.jar:/openhab/runtime/lib/boot/org.apache.karaf.main-4.1.5.jar:/openhab/runtime/lib/boot/org.osgi.core-6.0.0.jar)

I searched the fourm and found by adding this can solve the problem, but never happen to me:
EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/"

I recreate the docker container and still the sys binding won’t work and has the same errors.
Could you please take a look at it or please if any openhab guru can help, thanks

Docker is a highly constrained environment. The udev library is simply not installed in the container. And given that the container is supposed to be as isolated from the host as possible, I’m not sure the SystemInfo binding makes much sense. Even after all the needed native libraries are installed, I’m not sure it would work because SystemInfo will need access to all sorts of files in /dev and /proc that will not exist in the container or if they exist, they will represent the state of the container, not of the host.

In short, you will either need to spend a whole lot of work figuring this out and it still may not work, or you need to run openHAB natively instead of in Docker.

hey Rick, thanks again for your detail explaination, I figured it out with this command and solve the problem(sort of):

  • login to container (mine is a arm64v8 cpu so I use openhab/openhab:2.3.0-arm64-debian image, latest one pulled from docker hub)
  • inside container, run apt-get install -y udev:armhf
  • then run ls -s /lib/arm-linux-gnueabihf/ /lib/linux-arm
  • restart container
    Finally the systeminfo binding works and shows cpu temp, load etc…
    However like you side above, container is a highly isolated environment, which means everytime I pull the latest image I have to run this command again, could you please consider adding this command to docker image arm64? Thanks

You can open an issue on the openhab-docker repo on github.

The proper way to handle this is you should create a Dockerfile that is based on the official openhab Image and that installs the missing library. Then build your own Image and run containers from your Image.