[systemd-devel] udev rules environment variable

Robert Milasan rmilasan at suse.com
Tue Dec 17 05:05:56 PST 2013


On Tue, 17 Dec 2013 13:54:34 +0100
"Martin Pitt" <martin.pitt at ubuntu.com> wrote:

> Robert Milasan [2013-12-17 12:44 +0100]:
> > I have this rule as a test, but doesn't do squat (meaning it doesnt
> > work) :)
> > 
> > ACTION=="add", SUBSYSTEM=="net", KERNEL=="?*", ENV{test_device}="1"
> > 
> > ACTION=="remove", SUBSYSTEM=="net", KERNEL=="?*",
> > ENV{test_device}=="1", RUN+="/bin/sh -c 'echo test_device
> > > /tmp/test_device.log'"
> 
> Drop the KERNEL== bits. Network devices don't have a /dev/... device
> node in Linux, so KERNEL will never be set for those.
> 
> Martin

Even without the KERNEL== doesn't seem to work:

I'm testing this by first removing the network device (ex. rmmod
e1000), so I can have first an ADD event and then a REMOVE event, by
removing again the module, so:

rmmod e1000 (remove first)
modprobe e1000 (ADD event, set the test_device var to 1)
rmmod e1000 (REMOVE event, get the test_device value)

This doesn't seem to work, or at least it looks like that.

-- 
Robert Milasan

L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: rmilasan at suse.com
GPG fingerprint: B6FE F4A8 0FA3 3040 3402  6FE7 2F64 167C 1909 6D1A


More information about the systemd-devel mailing list