udev and PATH problems
Ignacio García Pérez
iggarpe at terra.es
Wed May 16 10:40:06 UTC 2007
Hi,
I have a small but quite annoying problem for which I can't find a
"good" solution. My setup is full custom, and I'm using udevd with a
custom set of rules. Things like this:
ACTION=="add", SUBSYSTEM=="net", \
RUN+="/sbin/ifup $env{INTERFACE}"
The problem is that when udevd runs /sbin/ifup, it does not pass a valid
PATH environment variable. Since ifup actually calls several external
programs (ifconfig, ip, route, etc), if the PATH is not correctly set,
they won't be found and ifup will fail miserably.
Here's the solution I'm using right now:
ACTION=="add", SUBSYSTEM=="net", \
ENV{PATH}="/sbin:/bin:/usr/sbin:/usr/bin", \
RUN+="/sbin/ifup $env{INTERFACE}"
And yeah, works fine, but I must add the "ENV{PATH}=" directive on each
and every udev rule that runs a program, and that is far from a good
solution (plus bloats the rules files a lot).
Anyone with a broader perspective can suggest a better solution?
Best regards.
P.S: I'm using FC6 for my desktop and noticed that it does not deal with
the PATH environment variable wherever it executes a program in a rule.
Has red hat patched udev?, or is it just that all external programs take
care of this themselves? (if the program is a shell script, it can set
the PATH right at the start, if the program is an executable binary, it
is ok not to have a PATH as long as you don't call other external
programs as busybox's ifup does...)
More information about the busybox
mailing list