Error: Could not find a gateway on given path '/dev/ttyUSB0', 0 ports available

Hi all,

I’m running OH 3.3.0 as Docker container on my QNAP. I’m trying to add the modbus USB adapter and I have followed the guide to ensure:

  1. the device is loaded with correct driver
  2. permission is set correctly (777 for now)
  3. Extra java options are passed to container (EXTRA_JAVA_OPTS=-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0)
  4. –device is added to the docker run command

The setup seems to work well except that when I restart container, it sometimes losses connection to the serial port with an error message “IOException Could not find a gateway on given path ‘/dev/ttyUSB0’, 0 ports available.” The error occurs randomly when I restart the container, and normally it get resolved by restarting the container again (or a couple of times). Once the connection to the ttyUSB0 succeeds, it never fails until next restart.

Not sure what could be the root cause but I’d very much like to make the restart more predictable. Any suggestion where to look is very much appreciated!