Bug 1024074 - Unable to execute udev rules "systemd-udevd: unknown key 'SYSFS{device}' in /etc/udev/rules.d/99-qlcnic.rules:1"
Unable to execute udev rules "systemd-udevd: unknown key 'SYSFS{device}' in /...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: udev (Show other bugs)
7.0
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Harald Hoyer
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-28 14:20 EDT by manish
Modified: 2014-11-11 08:50 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-31 08:34:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description manish 2013-10-28 14:20:11 EDT
Description of problem:

On the event from ethernet device driver udev daemon is unable to execute udev rules.
system logs show following messages.

Oct 18 17:25:22 dut3145 systemd-udevd: unknown key 'SYSFS{device}' in /etc/udev/rules.d/99-qlcnic.rules:1
Oct 18 17:25:22 dut3145 systemd-udevd: invalid rule '/etc/udev/rules.d/99-qlcnic.rules:1'



Version-Release number of selected component (if applicable):
[root@dut3145 ~]# uname -r
3.10.0-28.el7.x86_64
[root@dut3145 ~]# uname -a
Linux dut3145 3.10.0-28.el7.x86_64 #1 SMP Mon Sep 23 17:57:58 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux


How reproducible:
Always

Steps to Reproduce:
1.Generate udev event from driver
2.udev rules will get invoked 
3.udev rules fails to execute

Actual results:
Oct 18 17:25:22 dut3145 systemd-udevd: unknown key 'SYSFS{device}' in /etc/udev/rules.d/99-qlcnic.rules:1
Oct 18 17:25:22 dut3145 systemd-udevd: invalid rule '/etc/udev/rules.d/99-qlcnic.rules:1'


Expected results:
I am thinking it should pass

Additional info:

cat 99-qlcnic.rules
SUBSYSTEM=="pci", SYSFS{device}=="0x8020", ACTION=="change", RUN+="qlcnic_udev.sh"
SUBSYSTEM=="pci", SYSFS{device}=="0x8030", ACTION=="change", RUN+="qlcnic_udev.sh"
SUBSYSTEM=="pci", SYSFS{device}=="0x8040", ACTION=="change", RUN+="qlcnic_udev.sh"


is there any change in udev rules? were SYSFS key pair rules removed in this kernel? when I use ATTRS key value instead of SYSFS it works fine but with this error
(invalid key/value pair in file /etc/udev/rules.d/99-qlcnic.rules on line starting at character('\n')). But invocation of "qlcnic_udev.sh" works fine
which runs when udev rules gets executed.

Note: SYSFS key value pair is working on redhat 6.X OS.



Also, On invocation of udev rules(when using ATTRS) "qlcnic_udev.sh"
which is user space script is failing for ethtool operations due to SELINUX enforcement. I am trying to create a file on file system in qlcnic_udev.sh script using this command

ethtool -w ethX data /opt/xyz.bin

which is not creating any file in /opt directory.
is this expected or a BUG?

Please let me know if you need additional informations


Thanks
Manish
Comment 2 Harald Hoyer 2013-10-31 08:34:30 EDT
(In reply to manish from comment #0)
> cat 99-qlcnic.rules
> SUBSYSTEM=="pci", SYSFS{device}=="0x8020", ACTION=="change",
> RUN+="qlcnic_udev.sh"
> SUBSYSTEM=="pci", SYSFS{device}=="0x8030", ACTION=="change",
> RUN+="qlcnic_udev.sh"
> SUBSYSTEM=="pci", SYSFS{device}=="0x8040", ACTION=="change",
> RUN+="qlcnic_udev.sh"

These rules should look like this:

SUBSYSTEM=="pci", ATTRS{device}=="0x8040", ACTION=="change", RUN+="/path/to/qlcnic_udev.sh"

1. SYSFS is long deprecated and has been removed with udev-173
   it should be replaced by ATTR or ATTRS to match any parent device.
2. RUN only executed commands, which have a full path specified (there is no PATH)
3. If you are using ATTRS, you might want to add additional filters, as it can then RUN for several sub events of a device
Comment 3 QLogic Linux NIC Driver 2013-11-26 02:58:41 EST
Hi Harald,

As you said
"If you are using ATTRS, you might want to add additional filters, as it can then RUN for several sub events of a device"

Can you please tell us what additional filters can we add?
Here is the mechanism this "qlcnic_udev.sh" script gets invoked on udev event.

An ethernet device driver sends an event using kernel callback kobject_uevent_env(). This event causes to run this script on this event. We only want that this script gets invoked by this event from ethernet driver only.

Can you please help us how can we make it only to invoke on behalf of the event generated from the ethernet device driver? We don't want to invoke this on behalf of several sub events of a device.


Thanks
Comment 4 Harald Hoyer 2014-11-11 08:50:00 EST
(In reply to QLogic Linux NIC Driver from comment #3)
> Hi Harald,
> 
> As you said
> "If you are using ATTRS, you might want to add additional filters, as it can
> then RUN for several sub events of a device"
> 
> Can you please tell us what additional filters can we add?
> Here is the mechanism this "qlcnic_udev.sh" script gets invoked on udev
> event.
> 
> An ethernet device driver sends an event using kernel callback
> kobject_uevent_env(). This event causes to run this script on this event. We
> only want that this script gets invoked by this event from ethernet driver
> only.
> 
> Can you please help us how can we make it only to invoke on behalf of the
> event generated from the ethernet device driver? We don't want to invoke
> this on behalf of several sub events of a device.
> 
> 
> Thanks

use ATTR instead of ATTRS then.

Note You need to log in before you can comment on or make changes to this bug.