3

I was setting up some udev rules in Ubuntu 12.04 for my APC UPSs and I was using the included *-net.rules as reference. When I used ATTR{}=="" matching in my -ups.rules though it didn't work, I had to switch to ATTRS{}=="" to get it to work.

Now I'm wondering:

  • Is the system built in udev rules for eth0 and eth1 broken?
  • Should they be using ATTRS instead of ATTR?
  • How would I check to make sure they are working?
  • How do I even list the ATTRS for the network devices? I can't find a device node on which to run udevadm.
4

Take a look at udev's manpage:

ATTR{filename}
       Match sysfs attribute values of the event device. Trailing
       whitespace in the attribute values is ignored, if the specified
       match value does not contain trailing whitespace itself.

vs

ATTRS{filename}
       Search the devpath upwards for a device with matching sysfs
       attribute values. If multiple ATTRS matches are specified, all of
       them must match on the same device. Trailing whitespace in the
       attribute values is ignored, if the specified match value does not
       contain trailing whitespace itself.

ATTR{} only looks at the node being added. ATTRS{} searches the tree. It's probably that your UPS needed ATTRS{} because the sysfs attribute that you needed wasn't at the node that you specified.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.