[systemd-devel] Question about a udev rule
Hannes Reinecke
hare at suse.de
Sun Dec 8 23:08:32 PST 2013
On 12/08/2013 07:14 PM, Robert Milasan wrote:
> I've got this small rule which seems to not work at all:
>
> ACTION!="add|change", GOTO="end_root_symlink"
> SUBSYSTEM!="block", GOTO="end_root_symlink"
> ENV{DEVTYPE}!="partition", GOTO="end_root_symlink"
>
> IMPORT{program}="/usr/bin/udevadm info --export --export-prefix=ROOT_
> --device-id-of-file=/" ENV{MAJOR}!="0", ENV{MAJOR}=="$env{ROOT_MAJOR}",
> ENV{MINOR}=="$env{ROOT_MINOR}", SYMLINK+="root"
>
> LABEL="end_root_symlink"
>
> Can anyone tell me what I'm doing wrong?
>
'udevadm info' pulls information from the udev database, which is
filled with information _after_ the rule has been processed.
So for the current event the udev database will be empty.
Also, calling 'udevadm info' from a udev rule is inherently wrong,
due to two reasons:
1) udev rules deal with single events only. So all information for
the current event is directly available (set in environment
variables etc), and there is no need to call 'udevadm info'
2) For cross-event mechanisms (ie if you need to synchronize
between several events) you should be using appropriate
mechanisms like collect.
And the 'root' symlink is generated directly by dracut; maybe you
should look there ...
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare at suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
More information about the systemd-devel
mailing list