Comment 8 for bug 50099

Revision history for this message
Mark Ferguson (markfergy) wrote :

I think I have found a solution to this problem, well it's fixed things for me.

This is quite a verbose answer if you are not interested in all the details, see
the section labeled FIX at the bottom for the file to change.

There are two systems that I have found that deal with the network interfaces during boot.

The networking script in /etc/init.d (started from /etc/rcS.d)

And the udev system, which is started before the networking script in /etc/rcS.d

udev uses the /etc/udev/rules.d/85-ifupdown.rules to define it's network rules.

I am not sure how these to systems relate to each other, only that udev is
started before the networking.

I knew that there was nothing wrong with the networking script, as I used this
to restart the network interfaces successfully after boot.

Both the networking script and 85-ifupdown.rules file use ifup as the command
to bring the network up.

Contents of 85-ifupdown.rules:

/***********************************************************************/
SUBSYSTEM!="net", GOTO="net_end"

# Bring devices up and down only if they're marked auto.
# Use start-stop-daemon so we don't wait on dhcp
ACTION=="add", RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup -- --allow auto $env{INTERFACE}"
ACTION=="remove", RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown -- --allow auto $env{INTERFACE}"

LABEL="net_end"
/*********************************************************************/

This is the bit we are interested in:

/sbin/ifup -- --allow auto $env{INTERFACE}

I noticed that there was something not quite right with this command.

The "--" after /sbin/ifup means that there are no more options after this
point on the command line. Anything after this point is considered a
parameter. For the ifup command "--allow" and "auto" are thought to
be interfaces to be brought up, which is incorrect.

For example this is the error reported from ifup if I run the command manually
(ath0 is my wireless card)

/sbin/ifup -- --allow auto ath0

Ignoring unknown interface --allow=--allow.
Ignoring unknown interface auto=auto.

Though running this from the command line will still bring ath0 up.

The command "/sbin/ifup -- --allow auto $env{INTERFACE}" is supposed to mean
bring the network up if it is defined in the network interfaces file with auto

I tried running the same command for my eth0 interface which is not defined as
auto in the interfaces file. The interface was brought up, which it should not
have been.

If I correct the command to not include the -- after /sbin/ifup things work
as expected ie:

/sbin/ifup --allow auto ath0
(brings up ath0 with no errors)

/sbin/ifup --allow auto eth0
(does nothing as expected)

FIX to /etc/udev/rules.d/85-ifupdown.rules: Remove unnecessary "--" from ifup and ifdown cmds.
/***********************************************************************/
SUBSYSTEM!="net", GOTO="net_end"

# Bring devices up and down only if they're marked auto.
# Use start-stop-daemon so we don't wait on dhcp
ACTION=="add", RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup --allow auto $env{INTERFACE}"
ACTION=="remove", RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown --allow auto $env{INTERFACE}"

LABEL="net_end"
/*********************************************************************/

Maybe someone else can explain the relationship between udev and the networking
script, as I don't know. All I know is that the command syntax in the 85-ifupdown.rules
file was causing the problem.

I should probably also mention that this network behaviour did not always occur when
my ethernet card was the primary interface. It did occur intermittently, but only became
a major issue when I changed to using the wireless card as the primary interface.

When I started kubuntu for the first time with this change it took longer to complete
the network configuration than previously on boot. And I could see the communication
with my adsl modem, which didn't occur before. I have been running with this change
for a week now and experienced no problems.

Hope this helps.