Problem with udev/ifupdown (PATH is not set)
Ignacio García Pérez
iggarpe at terra.es
Tue Nov 27 08:48:43 UTC 2007
I want udevd to automatically set up any SLIP interface as soon as it
shows up (which is done using slattach), so I have this simple rule:
(actually, this will bring up ANY network interface as soon as it shows up)
ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifdown $env{INTERFACE}"
But it doesn't work. It turns out that udevd does not set the PATH
environment variable for the external programs it runs. Since ifupdown
calls several exteral programs (ifconfig, route, etc) WITHOUT specifying
their path, they are simply not found and the whole thing does not work
at all.
The following rule solves the problem:
ACTION=="add", SUBSYSTEM=="net",
ENV{PATH}="/usr/sbin:/usr/bin:/sbin:/bin", RUN+="/sbin/ifdown
$env{INTERFACE}"
So I have a solution. But the problem is I don't think this is right.
I'm forced to first set ENV{PATH} for every rule that runs an
executable which MIGHT call other executables.
Should udevd be setting a default PATH value?
Should ifupdown call the external programs using the complete path
(/sbin/ifconfig and such instead of just "ifconfig")?
Should ifupdown set a default PATH value before calling external
programs (at least when it detects PATH is not already set?
IMHO the third option is the one that makes most sense. Since ifupdown
as it is now does not specify complete paths to external programs, it is
actually expecting PATH to be set, but in certain situations like this
one it is not going to be set.
Nacho.
More information about the busybox
mailing list