Bug 977354

Summary: systemd-udevd - faulty parsing of udev rules
Product: [openSUSE] openSUSE Distribution Reporter: Per Jessen <per>
Component: BasesystemAssignee: Dmitry Roshchin <dmitry>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: dmueller, ro, systemd-maintainers
Version: Leap 42.1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Per Jessen 2016-04-27 06:05:19 UTC
systemd-udevd seems to have an issue with missing newlinesi at the end of file:

in openSUSE 13.1:
systemd-udevd[284]: invalid key/value pair in file /usr/lib/udev/rules.d/90-hwrng.rules on line 1,starting at character 107 ('a')

same ting in bug#965512  (for leap421):
systemd-udevd[550]: invalid key/value pair in file /usr/lib/udev/rules.d/51-android.rules on line 115,starting at character 57

Fix: just add a newline.
Comment 1 Per Jessen 2016-04-27 07:54:42 UTC
(In reply to Per Jessen from comment #0)
> 
> Fix: just add a newline.

s/fix/work-around/
Comment 2 Ruediger Oertel 2016-04-27 08:42:12 UTC
trying systemd maintainers.
Comment 3 Dr. Werner Fink 2016-04-27 09:00:15 UTC
indeed?
Comment 4 Dr. Werner Fink 2016-04-27 09:03:04 UTC
The rules do not belong to systemd but to android-tools
Comment 5 Per Jessen 2016-04-27 09:20:23 UTC
Um, the reason I opened a separate report for this is that two rulesets already fell over on this poor parsing.  It seems to me to be better to fix the parsing than to keep fixing rulesets.
Comment 6 Dr. Werner Fink 2016-04-27 09:28:48 UTC
(In reply to Per Jessen from comment #5)

SUSE has no influence on how udevd parse its rules. Beside this man:udev(7) clearly defines how rules have to written.

If you want to change how udevd is parsing rules then report it upstream and see what Kay Sievers is saying about that.
Comment 7 Per Jessen 2016-04-27 13:15:23 UTC
(In reply to Dr. Werner Fink from comment #6)
> (In reply to Per Jessen from comment #5)
> 
> SUSE has no influence on how udevd parse its rules. Beside this man:udev(7)
> clearly defines how rules have to written.
> 
> If you want to change how udevd is parsing rules then report it upstream and
> see what Kay Sievers is saying about that.

For openSUSE, I thought it might be prudent to attempt to avoid future problems wrt udev rule parsing, that's all.  If there is no interest in that, feel free to close.
Comment 8 Dr. Werner Fink 2016-04-27 13:34:31 UTC
(In reply to Per Jessen from comment #7)

The only way I see is a rpmlint parser to check for valid udev rules.  Also the question rises why those rules are that broken as I guess that those had worked ... maybe packaging had broken those tools
Comment 9 Per Jessen 2016-04-28 10:46:11 UTC
Actually, there is something odd going on. This example is from 13.1 - 

systemd-udev complains about this:

systemd-udevd[284]: invalid key/value pair in file /usr/lib/udev/rules.d/90-hwrng.rules on line 1,starting at character 107 ('a')

I added a newline and it's fine. 

However, nothing complains about this rule:

/etc/udev/rules.d/70-persistent-net.rules:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:85:a6:a8:3d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

It has no trailing newline.  Also, in the 90-hwrng.rules file, character 107 is not an 'a'.
Comment 10 Per Jessen 2016-04-28 10:53:32 UTC
(In reply to Per Jessen from comment #9)
> Actually, there is something odd going on. This example is from 13.1 - 
> 
> systemd-udev complains about this:
> 
> systemd-udevd[284]: invalid key/value pair in file
> /usr/lib/udev/rules.d/90-hwrng.rules on line 1,starting at character 107
> ('a')
> 
> I added a newline and it's fine. 
> 
> However, nothing complains about this rule:
> 
> /etc/udev/rules.d/70-persistent-net.rules:
> 
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:14:85:a6:a8:3d", ATTR{type}=="1", KERNEL=="eth*",
> NAME="eth0"

Looking at 13.1, there is plenty of rule files with no trailing newline on the last line.  Probably the same in leap421.
Comment 11 Dr. Werner Fink 2016-04-28 11:05:20 UTC
(In reply to Per Jessen from comment #9)

this is fixed for Leap:

 * Fri Dec 27 2013 crrodriguez@opensuse.org
 - udev does not like rules without a new line
Comment 12 Dr. Werner Fink 2016-04-28 11:06:44 UTC
Your report is for Leap 42.1 and the mentioned file is fixed there