Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24308 - runscript.sh "need" dependency insists on bringing up all interfaces
Summary: runscript.sh "need" dependency insists on bringing up all interfaces
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-11 14:21 UTC by Guillaume Marceau
Modified: 2005-05-30 20:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
First tentative patch (runscript.sh.patch-old,1.57 KB, patch)
2003-07-16 15:04 UTC, Guillaume Marceau
Details | Diff
Second tentative patch (runscript.sh.patch,2.95 KB, patch)
2003-07-16 15:09 UTC, Guillaume Marceau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Marceau 2003-07-11 14:21:48 UTC
In runscript.sh, there is a section of code titled: "Only worry about a net.*
sevice if we do not have one ip and running already." This section reports a
failure when the first interface fails to come up, but the second succeeds. It
should not.

Reproducible: Always
Steps to Reproduce:
1. Install two interfaces (eth0, eth1)
2. Unplug eth0
3. /etc/init.d/net.eth* stop
4. /etc/init.d/sshd start

Actual Results:  
sshd will try to bring up eth0 (and fail), then try to bring up eth1 (and
succeed). Then "sshd start" fails.

Expected Results:  
sshd should have been succesful

The following patch fixes the problem

--- /sbin/runscript.sh~	2003-07-11 17:02:39.000000000 -0400
+++ /sbin/runscript.sh	2003-07-11 17:04:04.000000000 -0400
@@ -252,22 +252,24 @@
 					then
 						/etc/init.d/"${myserv}" start
 
-						# A 'need' dependancy is critical for startup
-						if [ "$?" -ne "0" -a -L "${svcdir}/need/${x}/${myservice}" ]
-						then
-							local netcount="$(ls -1 ${svcdir}/started/net.* 2> /dev/null | \
+					fi
+				done
+                                # A 'need' dependancy is critical for startup
+                                if [ "$?" -ne "0" -a -L
"${svcdir}/need/${x}/${myservice}" ]
+                                    then
+                                    echo Testing:
+                                    ls -1 ${svcdir}/started/net.*
+                                    local netcount="$(ls -1
${svcdir}/started/net.* 2> /dev/null | \
 								grep -v 'net\.lo' | egrep -c "\/net\.[[:alnum:]]+$")"
-						
+                                    
 							# Only worry about a net.* service if we do not have
 							# one up and running already, or if
 							# RC_NET_SCTRICT_CHECKING is set ....
-							if [ "${netcount}" -lt "1" -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
-							then
-								startfail="yes"
-							fi
-						fi
-					fi
-				done
+                                    if [ "${netcount}" -lt "1" -o
"${RC_NET_STRICT_CHECKING}" = "yes" ]
+                                        then
+                                        startfail="yes"
+                                    fi
+                                fi
 			else
 				if [ ! -L "${svcdir}/started/${x}" ]
 				then
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-16 11:01:11 UTC
Please add the patch as attachment.
Comment 2 Guillaume Marceau 2003-07-16 15:04:19 UTC
Created attachment 14564 [details, diff]
First tentative patch

With this patch, an attempt is made at bringing all the net.* interfaces up.
The dependency success if at least one interface is up after the attemps.
Comment 3 Guillaume Marceau 2003-07-16 15:09:09 UTC
Created attachment 14565 [details, diff]
Second tentative patch

With this patch, an attempt to bring an interface up will only be made if there
isn't an interface up already. This is better than the previous patch, I think.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-17 12:31:02 UTC
I think the approach of "try to bring them all up, but only fail if not
enough could be started" is the better one, as this is more what is expected.
Comment 5 Guillaume Marceau 2003-07-17 15:08:59 UTC
I have a laptop with both an Ethernet port and a wireless port. Depending on where I am in the building, I sometimes have access to one or the other, sometimes to both, and sometimes I have access to neither.

I filled this bug when I realized I could not start sshd with "/etc/init.d/sshd start" if I was in a wireless-enabled room, but I did not have the Ethernet wire plugged in.

With the first patch, runscript.sh stalls for 20 seconds trying to get an IP dhcp address over an non-existing wire, even if I have a perfectly good wireless connection going. It is rather annoying. The second patch realizes the wireless connection is A-OK, and start sshd right away.

What's really happening is, we do not have a clear semantic which says what "need net" should mean. Somebody should make a decision and document it.

Above was my particular story. I suspect in other cases, you really do want to have all interfaces up. And in some other cases maybe you care about have to most interfaces available. Maybe we could have difference need dependency for each. My case would be: "need net.some", the second: "need net.most", and third case: "need.all".

Of course, the general solution would be to do what ebuild packages do: have a first-order-logic language of boolean expressions to express dependencies between services.
Comment 6 Steve Garcia 2004-04-15 12:58:05 UTC
What is the status on this bug?  3/4 of a year later I'm having an identical situation as the original reporter.  I looked at the proposed patches, but it appears that runscript.sh has changed since then in the pertinent sections (maybe to address this problem?) so the patches are no longer appropriate.

Is something perhaps rebroken?  I don't remember seeing this problem a few months ago.
Comment 7 Dead Schorsch 2004-11-04 01:22:24 UTC
I am facing this problem too. I am additionally astounded, that the file /etc/conf.d/rc is containing a variable to control the behaviour, named RC_NET_STRICT_CHECKING. With this variable set to "no", network should be considered up, if at least one network interface besides net.lo was successfully started.

Unfortuanaly, this looks to be disregarded completly, as every net dependend process still tries to bring up my WLAN network, even if there is a connection on the fixed line.
Comment 8 SpanKY gentoo-dev 2005-05-30 20:53:13 UTC
make sure baselayout-1.11.12 doesnt handle this properly ... re-open if it doesnt

play around with RC_NET_STRICT_CHECKING in /etc/conf.d/rc