2

This question already has an answer here:

I have a four-port USB hub and four USB/serial adaptors. I want to ensure that the adaptor in port 0 is always called 'ttyUSB0' and so on.

udev will not allow device renames, with a rule such as:

KERNEL=="ttyUSB*", KERNELS=="1-1.4", NAME="ttyCOM3"

I get:

NAME="ttyUSB3" ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/00-ttyUSB.rules:3

a symlink is allowed, with a rule such as:

KERNEL=="ttyUSB*", KERNELS=="1-1.4", SYMLINK+="ttyCOM3"

resulting in:

/etc/udev/rules.d# ls -al /dev/ttyUSB0 /dev/ttyCOM*
lrwxrwxrwx 1 root root         7 Oct  7 11:22 /dev/ttyCOM3 -> ttyUSB0
crw-rw---- 1 root dialout 188, 0 Oct  7 11:22 /dev/ttyUSB0

the udev manual says "See systemd.link(5) for a higher-level mechanism for setting the interface name. The name of a device node cannot be changed by udev"

but this seems to only refer to network interfaces.

Is it possible to configure systemd (or some other layer) to create the ttyUSB[0123] nodes the way I want?

Thanks,

marked as duplicate by sourcejedi, Thomas, jimmij, Mr Shunz, Christopher Feb 5 at 17:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • not systemd but udev rules. Check the related links shown at the right – Serge Oct 7 '16 at 14:08
  • All I've read implies this no longer possible with udev. It can make symlinks, but does not control the initial assignment of ttyUSB[0123] which is what I am hoping for. Is there a specific example of this? – Dave Lawrence Oct 7 '16 at 21:08
  • Why symlinks could not satisfy your needs? – Serge Oct 8 '16 at 16:49
  • Hi, I can work with the symlinks, but I would like to know if the initial naming of the ports can be fixed as I've described as was obviously possible in the past as I've seen examples using NAME (as above) – Dave Lawrence Oct 9 '16 at 14:17
  • It depends on order of enumeration of all ports, so if you plug one more serial usb adapter the order could change. I would not rely on that naming but create symlinks using device serial number and other attributes available to udev. – Serge Oct 9 '16 at 16:41

Browse other questions tagged or ask your own question.