Linux

ubuntu 中的 udev 規則

  • June 2, 2015

我在 Ubuntu 12.04 中為我的 APC UPS 設置了一些 udev 規則,並使用包含*-net.rules的作為參考。當我在我的中使用ATTR{}==""匹配時,-ups.rules雖然它不起作用,但我不得不切換到ATTRS{}==""讓它工作。

現在我想知道:

  • 系統是否建立在udev規則中eth0並被eth1破壞?
  • 他們應該使用ATTRS而不是ATTR
  • 我將如何檢查以確保它們正常工作?
  • 我什至如何列出ATTRS網路設備?我找不到要在其上執行的設備節點udevadm

看看 udev 的手冊頁:

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.

對比

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{}只查看正在添加的節點。ATTRS{}搜尋樹。可能是您的 UPS 需要,ATTRS{}因為您需要的 sysfs 屬性不在您指定的節點上。

引用自:https://serverfault.com/questions/409340