Bug 1785112

Summary: invalid udev rule shipped in /etc/udev/rules.d/
Product: [Fedora] Fedora Reporter: Dominique Martinet <g.fhnrunznrqeqf>
Component: infinipath-psmAssignee: Honggang LI <honli>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: honli, rdma-dev-team
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: infinipath-psm-3.3-26_g604758e_open.fc31.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-12 01:41:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominique Martinet 2019-12-19 07:36:46 UTC
Description of problem:

Reloading udev rules (either at boot or with `udevadm control --reload-rules` shows this warning in the journal:

Dec 18 18:50:25 laptop systemd-udevd[865]: /etc/udev/rules.d/60-ipath.rules:4 Invalid value "kcopy/%02n" for NAME (char 7: invalid substitution type), ignoring, but please fix it.

Version-Release number of selected component (if applicable):
infinipath-psm-3.3-26_g604758e_open.fc31.2.x86_64

How reproducible:
always

Steps to Reproduce:
1. udevadm control --reload-rules
2. journalctl -n 100 | grep ipath
3.

Additional info:

I also believe that a rpm should never ship udev rules in /etc/udev/rules.d, 
please ship them to /usr/lib/udev/rules.d/ (it looks like %_udevrulesdir is defined if you buildrequire systemd-rpm-macros or anything pulling it)
Let's leave /etc conf files to admins.

Thanks,
-- 
Dominique Martinet

Comment 1 Honggang LI 2019-12-23 12:46:53 UTC
(In reply to Dominique Martinet from comment #0)

> Dec 18 18:50:25 laptop systemd-udevd[865]:
> /etc/udev/rules.d/60-ipath.rules:4 Invalid value "kcopy/%02n" for NAME (char
> 7: invalid substitution type), ignoring, but please fix it.

~]$ cat -n /etc/udev/rules.d/60-ipath.rules
1 KERNEL=="ipath", MODE="0666"
2 KERNEL=="ipath[0-9]*", MODE="0666"
3 KERNEL=="ipath_*", MODE="0600"
4 KERNEL=="kcopy[0-6][0-9]", NAME="kcopy/%02n", MODE="0666"

You are right the 4th line should be removed, because the /dev/kcopy/xx char device files
are created by QLogic/Intel "kcopy.ko" driver, which is only available in ancient
QLogic/Intel OFED driver. Fedora and RHEL-x does not have that driver.

For example, run this bash command with a RHEL-6.1 x86_64 machine, it will build the "kcopy.ko" module.

$ rpmbuild  -bc  --define 'configure_options --with-kcopy-mod' --define 'build_kernel_ib 1' ./QLogic-OFED.RHEL6-x86_64.1.5.4.1.23/SRPMS/ofa_kernel-1.5.4.1-2012_04_12.20_46_26.src.rpm

[root@localhost x86_64]# ls /dev/kcopy*
ls: cannot access /dev/kcopy*: No such file or directory
[root@localhost x86_64]# modprobe -v kcopy
insmod /lib/modules/2.6.32-131.0.15.el6.x86_64/updates/drivers/char/kcopy/kcopy.ko 
[root@localhost x86_64]# ls /dev/kcopy/*
00  02  04  06  08  10  12  14  16  18  20  22  24  26  28  30  32  34  36  38  40  42  44  46  48  50  52  54  56  58  60  62
01  03  05  07  09  11  13  15  17  19  21  23  25  27  29  31  33  35  37  39  41  43  45  47  49  51  53  55  57  59  61  63


> I also believe that a rpm should never ship udev rules in /etc/udev/rules.d, 
> please ship them to /usr/lib/udev/rules.d/ (it looks like %_udevrulesdir is
> defined if you buildrequire systemd-rpm-macros or anything pulling it)
> Let's leave /etc conf files to admins.

/lib/udev/rules.d contains default rules files. /etc/udev/rules.d contains customized rules files.
System admins can modify these files or create them. System admin may change the access rule of
/dev/ipath_diag* files for debugging purposes. That is why we should install the rule file in 
/etc/udev/rules.d .

In case you have any concerns about this, please let me know. Thanks.

 ~]$ ls -l /dev/ipath*
crw-rw-rw-. 1 root root 238,   0 Dec 22 21:39 /dev/ipath
crw-rw-rw-. 1 root root 238,   1 Dec 22 21:39 /dev/ipath0
crw-------. 1 root root 238, 129 Dec 22 21:39 /dev/ipath_diag0
crw-------. 1 root root 238, 128 Dec 22 21:39 /dev/ipath_diagpkt

Comment 2 Dominique Martinet 2019-12-24 01:30:15 UTC
>> I also believe that a rpm should never ship udev rules in /etc/udev/rules.d, 
>> please ship them to /usr/lib/udev/rules.d/ (it looks like %_udevrulesdir is
>> defined if you buildrequire systemd-rpm-macros or anything pulling it)
>> Let's leave /etc conf files to admins.
>
> /lib/udev/rules.d contains default rules files. /etc/udev/rules.d contains customized rules files.
> System admins can modify these files or create them. System admin may change the access rule of
> /dev/ipath_diag* files for debugging purposes. That is why we should install the rule file in 
> /etc/udev/rules.d .

That's not how it works. admins might want to modify all and any rule for debugging purposes, that is why udev will ignore any file in /lib/udev/rules.d if a file with the same name exists in /etc/udev/rules.d

For example if you ship /lib/udev/rules.d/60-ipath.rules instead, and an admin want to modify it, all they have to do is copy the file to /etc and fix the permissions they need and udev will properly load their files and not the package-provided one.

It is very confusing to have package-provided files in /etc, on my system the only rules there are my own rules, 70-persistent-ipoib.rules that comes from a package as well but does not contain any rule (purely example with comments -- I'd argue it also does not belong there (could be in /usr/shared/doc), but at least it is no-op) and this one. I'm sure this is not the only package that might need adjusting for debugging prupores. Please reconsider.

Thanks,
-- 
Dominique

Comment 3 Honggang LI 2019-12-24 09:33:51 UTC
Will move the rule file into /lib/udev/rules.d .

Thanks

Comment 4 Fedora Update System 2019-12-26 05:20:31 UTC
FEDORA-2019-0683efba06 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-0683efba06

Comment 5 Fedora Update System 2020-01-04 22:23:19 UTC
infinipath-psm-3.3-26_g604758e_open.fc31.4 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-0683efba06

Comment 6 Fedora Update System 2020-01-12 01:41:40 UTC
infinipath-psm-3.3-26_g604758e_open.fc31.4 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.