[solved] Docker - udev rule - serial binding - serial port not found

I run openhab 2.2.0-amd64 in a docker container under Ubuntu server 16.04.4 LTS.
I dont know if it is a docker or an binding issue. So I start here :slight_smile:

I use an usb interface to get values from my energy meter device.
The usb interface itself works fine without problems.
To access the interface I set up an udev rule (name: “lesekopf_strom”).
The rule seems to work corret. The interface connects to ttyUSB1.

ls -l /dev/lesekopf_strom
lrwxrwxrwx 1 root root 7 Mär 25 00:51 /dev/lesekopf_strom -> ttyUSB1

Now my issue.
If I start Openhab container with the option:

--device=dev/ttyUSB1

I get access to the interface with the serial binding :smiley:

But if I start the container with:

--device=/dev/lesekopf_strom

I get the following error:

java.io.IOException: Error at SerialConnector.openConnection: serial port not found /dev/lesekopf_strom.

I run the container under root. So it could not be an issue with the right …. or?

I found a solution :slight_smile:

To get access to the symlink within the container I need the additional environment variable

 -e EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/lesekopf_strom"

I found this only documented for openhab 1.x.

2 Likes