Running 3.3 release, the USB serial adapter ports of my Raspi vanished from openHAB after a reboot.
Things to use them remain offline claiming “No such port /dev/ttyUSB2”.
But the ports ARE there from the OS perspective. 3 adapter with a CH341 chipset if that matters.
I’ve already selectively restarted the serial related bundles, and explicitly started java with -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1:/dev/ttyUSB2:..... but no luck.
Debugging of serial transport tells me:
2022-09-22 11:16:42.646 [DEBUG] [ort.serial.internal.RxTxPortProvider] - No SerialPortIdentifier found for: /dev/ttyUSB2
2022-09-22 11:16:42.953 [DEBUG] [ort.serial.internal.RxTxPortProvider] - No SerialPortIdentifier found for: /dev/ttyUSB1
2022-09-22 11:16:43.048 [DEBUG] [ort.serial.internal.RxTxPortProvider] - No SerialPortIdentifier found for: /dev/ttyUSB0
The rxtx (nrjavaserial) ships its own locking mechanism based on files to guarantee exclusive access to serial port. Sometimes these locks are not being released thus serial port can not be opened. I think @fwolter can elaborate a bit more about cause.
IIRC nrjavaserial only removes stale locks if the PID in them no longer exists. So if another process is running with the old PID that openHAB had before it starts it will not remove the lock files and you might run into this issue.
Usually your OS already takes care of removing these temporary files on bootup. On Debian based distros this is done using tmpfiles.d (e.g. /usr/lib/tmpfiles.d/legacy.conf).