Race condition (?) between networking and rcS/rc2-5 scripts

Jeremy Wolcott jeremy.wolcott at gmail.com
Sat Jan 2 05:48:33 GMT 2010


Hi,

I'm not sure if this is the right place for this question, but I thought 
it was probably too technical for the forums...

Anyway, I seem to be seeing a race condition between the Upstart 
networking initscript and a couple of the SysV ones on my server, 
namely, dhcp3-server (rc2-5) and shorewall (rcS).  I started noticing 
the problem after upgrading from 9.04 to 9.10, which is part of why I 
think it's related to Upstart (my understanding is this was when most of 
the system service initscripts were converted to Upstart).

Basically, the problem (I think) is that I have a bridge grouping a 
wireless interface and two wired ones, and it takes some time for it to 
set up.  Both the DHCP server and Shorewall depend on this bridge to be 
up before they start because they use it: the bridge interface is the 
one that DHCP addresses are served over, and the Shorewall firewall runs 
IP masquerading through this interface (so it needs to be able to 
calculate routes through it).  But their initscripts seem to be running 
before the networking one is finished, since (according to their logs) 
the interface br0 (the bridge) doesn't exist yet:

-- shorewall-init.log --
18:07:33 Setting up Masquerading/SNAT...
    ERROR: Unable to determine the routes through interface "br0"

-- syslog --
Dec 29 18:07:32 localhost, kernel: [   13.786636] ip6_tables: (C) 
2000-2006 Netfilter Core Team
Dec 29 18:07:33 localhost, logger: ERROR:Shorewall start failed
Dec 29 18:07:33 localhost, logger: Shorewall Stopped
.
.
.
Dec 29 18:07:43 localhost, dhcpd: No subnet declaration for br0 (0.0.0.0).
Dec 29 18:07:43 localhost, dhcpd: ** Ignoring requests on br0.  If this 
is not what
Dec 29 18:07:43 localhost, dhcpd:    you want, please write a subnet 
declaration
Dec 29 18:07:43 localhost, dhcpd:    in your dhcpd.conf file for the 
network segment
Dec 29 18:07:43 localhost, dhcpd:    to which interface br0 is attached. **
Dec 29 18:07:43 localhost, dhcpd:
Dec 29 18:07:43 localhost, dhcpd:
Dec 29 18:07:43 localhost, dhcpd: Not configured to listen on any 
interfaces!
.
.
.
Dec 29 18:07:56 localhost, kernel: [   37.541260] br0: port 3(wlan0) 
entering forwarding state


HOWEVER, if I wait till I can log in and manually start the services 
('/etc/init.d/dhcp3-server start', for example), then they start with no 
problems, which, if I am reading the log correctly, is because the 
bridge has finally set up (the last line I included above).  This seems 
pretty strange since both scripts list $network in the 'Required-Start' 
fields of their 'Init Info' sections... but there you have it.  (I DID 
notice that /etc/init/rc-sysinit.conf requires the loopback interface to 
be up before starting, and I briefly considered adding a requirement 
that the bridge be up too, but I was afraid of introducing other 
problems since I don't know very much about how the pieces of the SysV 
init system fit together.)

I'm definitely not an initscript aficionado, so I'm not sure how to try 
to fix this.  Do the named SysV scripts need to be rewritten 
Upstart-style?...  If so, I might be able to give it a go -- but I'm not 
a very good bash scripter and I'm worried I'll probably screw something up.

Any help or advice would be thoroughly appreciated.  Thanks,

-Jeremy



More information about the upstart-devel mailing list