udev and PATH problems
Denis Vlasenko
vda.linux at googlemail.com
Wed May 16 22:31:28 UTC 2007
On Wednesday 16 May 2007 12:40, Ignacio García Pérez wrote:
> 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?
Start udevd with PATH set:
PATH=/sbin:/bin:/usr/sbin:/usr/bin udevd ...
I just grepped thru udev-084 sources. It doesn't seem to try to unset the PATH.
So it's children most likely will inherit it.
--
vda
More information about the busybox
mailing list