0

On a Raspberry Pi 4 running Ubuntu 20.04 on aarch64, I have a USB ZWave device that I want to expose at a specific name, so I wrote a simple udev rule to do so, but it doesn't seem to work.

The vendor:product id is 0658:0200

My rule is

ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", NAME="ttyZWAVE0"

Yet the device continues to show up as ttyACM0.

If I use the following rule, which has the same match criteria, to create a symbolic link instead, the symbolic link does show up correctly:

ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyZWAVE0"

Here was my udevadm --name=/dev/ttyACM0 --attribute-walk output before creating the rule:

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1':
    KERNELS=="1-1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{bcdDevice}=="0000"
    ATTRS{version}==" 2.00"
    ATTRS{rx_lanes}=="1"
    ATTRS{devpath}=="1.1"
    ATTRS{removable}=="unknown"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{idVendor}=="0658"
    ATTRS{bmAttributes}=="80"
    ATTRS{ltm_capable}=="no"
    ATTRS{bNumInterfaces}==" 2"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{idProduct}=="0200"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{busnum}=="1"
    ATTRS{urbnum}=="12"
    ATTRS{configuration}==""
    ATTRS{speed}=="12"
    ATTRS{tx_lanes}=="1"
    ATTRS{maxchild}=="0"
    ATTRS{devspec}=="(null)"
    ATTRS{devnum}=="3"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{quirks}=="0x0"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceClass}=="02"

Why does the rule to straight-up rename it not work, either with a udev trigger or a full system restart, yet the rule to add a symlink does work? Am I missing something simple?

I see nothing useful at all in journalctl (literally nothing even mentioning it, no errors, no nothing).

Edit to add:

This also seems to fail in the same way on my laptop, running Ubuntu 20.04 on amd64, with the exact same results (obviously with different parent device paths).

udevadm test /sys/path/to/device is giving no obvious answers, either, as to why it doesn't do what I expect. It does show it reading my rules and there are no errors...

3
  • I just tried writing the rule as KERNELS=="1-3", NAME="ttyZWAVE0", SYMLINK+="ttyZWAVE1" and what do I get? Still ttyACM0 and also the symlink for ttyZWAVE1. Why is it refusing to rename the device? It obviously is matching and taking action... But then it is ignoring the part I actually care about. Commented Jun 25, 2020 at 8:55
  • Continuing to look into it, I thought, ok...maybe one of the default rules was taking precedence. So I did a grep ACM /usr/lib/udev/rules.d/* and I can't find one that seems like it should be matching this device more specifically than my rule. Are udev rules a last-match-wins sort of thing, or does the most specific match win? Because my rules runs first, before any other rule. Commented Jun 25, 2020 at 9:12
  • Follow-up to my latest comment... I renamed my rule so it would run last, and udevadm test gave a new bit of useful output... ttyACM0: /etc/udev/rules.d/zzz.rules:1 Kernel device nodes cannot be renamed, ignoring NAME="ttyZWAVE0"; please fix it. So is this just not something I'm allowed to do at all, or is there a way around this? I found this, but man udev on my system has no such text: askubuntu.com/questions/546100/… Commented Jun 25, 2020 at 9:14

1 Answer 1

0

This is simply not allowed, according to udev documentation. As shown in a couple of other questions I found since I posted this one, it's mentioned in the man pages. I did not find this caveat until I named my rule in a way which would make it run last, triggering an error from udevadm test that pointed me in the right direction.

It is documented at the official site and in udev.7.

https://www.freedesktop.org/software/systemd/man/udev.html

1
  • 1
    Older versions of udev used to allow it, but it turned out to be open to abuse, and so modern versions are more strict. (The usual story: someone was being naughty, and that's why we all cannot have some nice things...)
    – telcoM
    Commented Nov 16, 2023 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .