Bug 2804

Summary: mdadm: udev rules dir is hardcoded to /lib
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jesse Zhang <sen.zhang>
Component: coreAssignee: Chen Qi <Qi.Chen>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: liang.li2, liezhi.yang, meta.mr.watcher, meta.watcher, Qi.Chen, sgw, song.liu, yi.zhao, zhenfeng.zhao
Version: 1.3   
Target Milestone: 1.4 M2   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Jesse Zhang 2012-07-20 07:17:02 UTC
mdadm hardcodes the udev rules dir to be /lib/udev/rules.d,

install-udev: udev-md-raid.rules
      $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules

while udev configs it to be ${base_libdir} (udev.inc: libexecdir = "${base_libdir}/udev").

Thus on 64bit targets, the mdraid.rules file will be missing.
Comment 1 Chen Qi 2012-11-26 10:51:24 UTC
Udev manual clearly say: 
"The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ and the temporary rules directory /run/udev/rules.d/."

Besides, there are other packages that hardcode udev rules directory to be '/lib/udev/rules.d/'. So I think it's not mdadm which should be fixed.
Comment 2 Jesse Zhang 2012-11-27 02:19:18 UTC
Yeah. But did you check an actual build?

meta/recipes-core/udev/udev.inc: libexecdir = "${base_libdir}/udev"

udev Makefile.am: udevrulesdir = $(libexecdir)/rules.d
Comment 3 Chen Qi 2012-11-27 02:32:31 UTC
(In reply to comment #2)
> Yeah. But did you check an actual build?
> 
> meta/recipes-core/udev/udev.inc: libexecdir = "${base_libdir}/udev"
> 
> udev Makefile.am: udevrulesdir = $(libexecdir)/rules.d

Yes. That's why this bug was originally reported. If the target arch is 'powerpc64', the udev rules directory would be '/lib64/udev/rules.d/'. However, the mdadm hardcodes its udevrulesdir to be '/lib/udev/rules.d/'. 

And I checked alsa-utils package, it also hardcodes udevrulesdir to be '/lib/udev/rules.d/'.

Thus, I think maybe we should not fix mdadm and other packages that hardcode udevrulesdir. After all, it's the manual that says it's the default directory.

Maybe we should fix udev? Say, make udev always install its rules files to '/lib/udev/rules.d'?
Comment 4 Jesse Zhang 2012-11-27 02:35:45 UTC
Yeah, that works for me too.
Comment 5 Chen Qi 2012-12-20 05:08:28 UTC
Applied the following commit made by Constantin Musca <constantinx.musca@intel.com>, there isn't any problem anymore.

http://cgit.openembedded.org/openembedded-core/commit/?id=0730a8cbb42cd8b6667f2d1daefa0f6fcec06af2

I tested with multilib and ppc64-arch, the udev rules files are shipped correctly.

So I changed the status of this bug to resolved.
Comment 6 liang li 2012-12-25 08:00:13 UTC
on arch qemu-x86-64 run "bitbake mdadm",the "64-md-raid.rules" found in dir "/lib/udev/rules.d" with git master commit 90c0eb29f0b41e4ac2d3d17ebad7295c2ebdc02a.