Raspberry Pi - Make serial USB ports persistent via symlinks

Still wait for an answer, The port is missing in Paper UI and in Habmin too. If i write it manually like “/dev/ttyUSB-ZStick” than the stick does not work. I get a message: “Serial Error; Port {0} does not exist”,

But the port exist, if i ls -l /dev/ttyUSB* i gen an answer /dev/ttyUSB-ZStick -> ttyACM0

Pls help…

If you don’t provide enough information we can’t answer, sorry.
Which openHAB version?
If you are on some of the newer snapshots there is a known issue:

Read above… There has been plenty informations, both in this thread an others… Symlinks does not work. Using 4 USB devices on a Rpi wiht openhab (atm openhab 2.5M1 build #1575) makes it a total nightmare whenever I reboot. And it´s not just zwave which is a problem.

Sry, but i dont know what information u need.
If i plug in the Aeotec z-wave stick, the system find it under /dev/ttyACM0.
A made a udev rule, where i set a link from /dev/ttyUSB-ZStick to ttyACM0.

But after this if i want to add the Stick as controller to Paper UI or Habmin, there is no possibility to choose any port, like before.
And if i write in manually the port name /dev/ttyUSB-ZStick or /dev/ttyACM0 than i get an error message “Serial Error; Port {0} does not exist”

Sorry, it was not you I was answering to. Forgot the quote.

As a minimum your openHAB version, even better #10:

In your case: old openHAB version, probably an operating system issue, newer snapshot openHAB version, probably an openHAB related problem (see my link to github)

I have the OpenHab 2.4 stable version and Ubuntu 18.04 LTS. Everything installed 3 days ago.

Did you also add that that port Symlink in the extra java opts as described in the first part here https://www.openhab.org/docs/administration/serial.html#serial-port-configuration?

i added this to my /etc/default/openhab2


@Rintano I have been using 3 USB devices on a Pi 3b+ with Symlinks and Openhab no problem. Works fine on a reboot. The zwave binding is actually the one that worked best with Symlinks for me. On a Pi with Openhabian and oh 2.5M1 this works for me:
Definition of my Symlinks added to the bottom of /etc/udev/rules.d/99-com.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ttyEnocean"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyZwave"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="ttyZigbee"

and this is what I added in the EXTRA_JAVA_OPTS line in /etc/default/openhab2


For me it was important to add them to the EXTRA_JAVA_OPTS line that was already there and not to make a new one and there is a bug in Openhabian that overwrites your EXTRA_JAVA_OPTS when you use the add common ports option in the openhabian-config.
I dint know if you have to do anything else when you use a manual installation.
Best regards Johannes

1 Like

I have just one EXTRA_JAVA_OPTS too. no other, but OpenHab still dont have access to the port somehow

PROBLEM RESOLVED: sudo usermod -a -G dialout openhab
was need to make

1 Like


Because the openhab user need to be in the group dialout. if not, have no access to read the serial ports

But in the first message of this thread, #6 it says:

Add openhab user to the right groups:
sudo adduser openhab dialout
sudo adduser openhab tty

When I do that, I´m beeing told openhab is already a member of tty and dialout.

1 Like

@KraxelHuber I know this topic is quiet old but it was a really useful tutorial to create and configure symlinks within openhab.

I’m running this setup for a while but it seems the binding that uses the symlink can’t recover once the connection es reestablished. The symlink is going to an USB port /dev/tty/USBGeneric and the configuration file for the binding is filled with the above symlink port. It happens from time to time that the symlink changes from eg. /dev/ttyUSB0 to /dev/ttyUSB1. Everytime the symlink changes (during runtime) the binding can’t find the USB port anymore, although it should be transparent for the binding as it is configured to use the symlink port /dev/tty/USBGeneric…

After restart of the binding all is fine… so I do not understand if there is something wrong with the symlink definition or the openhab binding or both… :slight_smile:
Using Openhabian 2.4 stable on a Pi Zero.

Did anybody have any similar behavior with openhab bindings not recovering after a connection drop although the USB port is still the same?

Appreciate your thoughts!


I followed all steps to get my Serial Port stable, too. But I can’t access that port from within openhab(ian) as its not displayed there - despite the fact that I added it in the config.
I changed group permissions but I get the following situation where the link is accessible via root:root and only the destination is accessible via root:dialout, is that correct?

ls * -l
lrwxrwxrwx 1 root root          12 Aug 14 21:49 ttyUSB-ZStick -> input/event0
drwxr-xr-x 4 root root         120 Aug 14 21:49 input

ls input* -l
crw-rw-rw- 1 root dialout 13, 64 Aug 14 21:49 event0

Thank you for help

Great tip. I’ve been using it for a while and works perfectly. Except… when I’m upgrading to a new (snapshot) version of OpenHAB. Then the /etc/default/openhab2 file is being overwritten.

Is there a way to prevent the file from being overwritten when upgrading. Or even better, can we achieve the same with a configuration that does not get overwritten by a newer version when upgrading?

I think https://github.com/openhab/openhab-linuxpkg/pull/139 will resolve this, but @pauli_anttila would know best.

Hi Markus… Did you ever get this problem fixed??
I have finally found the reason why my symlinks have never worked. And it´s exact the same problem. My symlinks is only accessible from root, and not from dialout (and therefore not openhab as well).
This has been a huge problem for so long now, and due to updating to 2.5Release today I ran into the problem again, and now I cant get my RS485 USB dongle (modbus) to work. So I was forced to do something about it. Unfortunatly I cant seem to get this permission issue fixed :rage:

[22:10:56] openhabian@openHABianPi:~$ ls -al /dev | grep tty

lrwxrwxrwx  1 root root           7 Jan  1 18:52 ttyUSB_RS485 -> ttyUSB0
lrwxrwxrwx  1 root root           7 Jan  1 18:52 ttyUSB_ZStick -> ttyACM0