Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 29225 - net.lo should provide net
Summary: net.lo should provide net
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All All
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 48879 (view as bug list)
Depends on:
Blocks: 13143 33161 66472
  Show dependency tree
 
Reported: 2003-09-20 15:54 UTC by Radek Podgorny
Modified: 2004-10-31 04:25 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Radek Podgorny 2003-09-20 15:54:30 UTC
Hi,

sometimes, when on the move, I need to develop some PHP apps on my laptop. But a
great problem appears when there's no ethernet connection.

The dhcpcd client tryes to get some IP. After a while, it times-out which is
good. BUT! The apache (and other network services) refuse to start which is IMHO
stupid since they all can run on the loopback interface...

Changing the "need net" to "use net" in the apache startup script worked fine
and apache servers the pages correctly on the lo iface.

So, my question is: Why doesn't "net.lo" provide "net" just as "net.ethX" do?

I suggest correction the net.lo or all application startup scripts which depend
on net but can be run on lo as well...

Sincerely...
Radek


Reproducible: Always
Steps to Reproduce:
Comment 1 Radek Podgorny 2003-10-07 14:40:04 UTC
(copy of post to bug 13143 -> don't know who's gonna solve this)

Come on guys. Let net.lo provide "net" or remove the "need net" dependancies
from the startup scripts which don't need it (like apache and stuff) but
DO SOMETHING, please... Until then, I can't do the PHP development on my
notebook (when it's unplugged from the network while booting -> it cannot
get DHCP answer -> net.eth0 startup fails -> apache2 refuses to start) and
that's bad since PHP development is what I get money for... :-)

Of course I have my scripts modified but every upstream (Gentoo) update forces
me to do that research again and again... :-(

Thanks...
Radek
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-10-13 14:08:42 UTC
Add /etc/init.d/net.eth9 (or whatever, note its _not_ eth0):

--
#!/sbin/runscript

start() {
    ebegin "Starting fake network"
    eend 0
}
--

Add above to boot runlevel, and you should be set.

You might even call above 'net.fake', but I am not sure if it needs the
traling digit currently or not ...
Comment 3 Radek Podgorny 2003-10-14 14:40:17 UTC
I already use net.adsl which means you don't have to append the number...

Anyway, it's just a dirty hack. I was begging for some system-level solution...
:-(

Radek
Comment 4 Martin Holzer (RETIRED) gentoo-dev 2004-04-25 04:44:24 UTC
*** Bug 48879 has been marked as a duplicate of this bug. ***
Comment 5 SpanKY gentoo-dev 2004-05-02 12:25:14 UTC
this should be configurable in /etc/conf.d/rc now

# Set to "yes" if the default behaviour of at least one net.*
# service starting beside net.lo is NOT enouth to consider
# the 'net' dependency up and running.

RC_NET_STRICT_CHECKING="no"
Comment 6 Radek Podgorny 2004-05-02 12:58:09 UTC
Sorry to say, but this does NOT solve the bug. See the "beside net.lo" in the comment? This bug is about convincing the gentoo devs the "lo" interface is nothing special and is technically not different from for exapmple eth0. You can run apache and stuff when using ONLY loopback but the current setup does not consider the "net.lo" service to be a part of the "net" grou which apache depends on... :-(

Thanks...
Radek
Comment 7 SpanKY gentoo-dev 2004-05-02 13:07:23 UTC
umm, actually it does, read the comment

set RC_NET_STRICT_CHECKING=no and you need only have net.lo running to have 'net' considered up

i use that on my laptop and it works fine
Comment 8 Radek Podgorny 2004-05-02 13:28:00 UTC
OK, I have it set to "no" for some time now and AFAIK the only way to solve this problem was to have a net.fake interface... ...anyway, I will try it and let you know... ...thanks.

Radek
Comment 9 Radek Podgorny 2004-05-04 08:37:02 UTC
Sorry, not working. When I try to power on my laptop in a network-less :-) enviroment, the DHCP request (of the net.eth0) simply times out and sshd, xinetd, netmount and others just refuse to launch only telling the service they needed in their dependancy failed to load. BUT, there's something weird, distcc loads fine (has "net" as the only dep) but sshd (which also has only the "net" as dep) does not... Ask me further, please. I'd like to have this figured out...

Radek
Comment 10 SpanKY gentoo-dev 2004-10-31 03:31:53 UTC
ok, i was wrong about RC_NET_STRICT_CHECKING ...

it's purpose is to require all net.* scripts to work properly or at least one (not counting net.lo)

we'll look into alternative options ;)
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2004-10-31 04:25:12 UTC
Added a 'lo' option to RC_NET_STRICT_CHECKING

-----
Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-src/rc-scripts/ChangeLog,v
retrieving revision 1.458
diff -u -r1.458 ChangeLog
--- ChangeLog   31 Oct 2004 11:27:38 -0000      1.458
+++ ChangeLog   31 Oct 2004 12:23:08 -0000
@@ -12,6 +12,8 @@

     Move things around in /sbin/functions.sh to have all functions above.

+    Add the 'lo' option to RC_NET_STRICT_CHECKING to resolve bug #29225.
+
   28 Oct 2004; Martin Schlemmer <azarah@gentoo.org>:

     Only add files not managed by udev to device tarball, bug #57110.
Index: etc/conf.d/rc
===================================================================
RCS file: /var/cvsroot/gentoo-src/rc-scripts/etc/conf.d/rc,v
retrieving revision 1.18
diff -u -r1.18 rc
--- etc/conf.d/rc       28 Oct 2004 23:49:55 -0000      1.18
+++ etc/conf.d/rc       31 Oct 2004 12:23:08 -0000
@@ -15,8 +15,17 @@

 RC_PARALLEL_STARTUP="no"

-# Set to "yes" if you require a net.* service running (other than
-# just net.lo) to satisfy the generic 'net' dependency
+# RC_NET_STRICT_CHECKING allows some flexability with the 'net' service.
+# The following values are allowed:
+#  no    - This basically means that at least one net.* service besides net.lo
+#          must be up.  This can be used by notebook users that have a wifi and
+#          a static nic, and only wants one up at any given time to have the
+#          'net' service seen as up.
+#  lo    - This is the same as the 'no' option, but net.lo is also counted.
+#          This should be useful to people that do not care about any specific
+#          interface being up at boot.
+#  yes   - For this ALL network interfaces MUST be up for the 'net' service to
+#          be considered up.

 RC_NET_STRICT_CHECKING="no"

Index: sbin/rc-services.sh
===================================================================
RCS file: /var/cvsroot/gentoo-src/rc-scripts/sbin/rc-services.sh,v
retrieving revision 1.19
diff -u -r1.19 rc-services.sh
--- sbin/rc-services.sh 19 Sep 2004 05:39:28 -0000      1.19
+++ sbin/rc-services.sh 31 Oct 2004 12:23:08 -0000
@@ -556,6 +556,39 @@
        return 0
 }

+# bool is_net_up()
+#
+#    Return true if service 'net' is considered up, else false.
+#
+#    Notes for RC_NET_STRICT_CHECKING values:
+#      lo    Interface 'lo' is counted and if only it is up, net is up.
+#      no    Interface 'lo' is not counted, and net is down even with it up,
+#            so there have to be at least one other interface up.
+#      yes   All interfaces must be up.
+is_net_up() {
+       local netcount=0
+
+       case "${RC_NET_STRICT_CHECKING}" in
+               lo)
+                       netcount="$(ls -1 "${svcdir}"/started/net.* 2> /dev/null | \
+                                   egrep -c "\/net\..*$")"
+                       ;;
+               *)
+                       netcount="$(ls -1 "${svcdir}"/started/net.* 2> /dev/null | \
+                                   grep -v 'net\.lo' | egrep -c "\/net\..*$")"
+                       ;;
+       esac
+
+       # Only worry about net.* services if this is the last one running,
+       # or if RC_NET_STRICT_CHECKING is set ...
+       if [ "${netcount}" -lt 1 -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
+       then
+               return 1
+       fi
+
+       return 0
+}
+
 # void schedule_service_startup(service)
 #
 #   Schedule 'service' for startup, in parallel if possible.
Index: sbin/runscript.sh
===================================================================
RCS file: /var/cvsroot/gentoo-src/rc-scripts/sbin/runscript.sh,v
retrieving revision 1.39
diff -u -r1.39 runscript.sh
--- sbin/runscript.sh   28 Oct 2004 14:01:27 -0000      1.39
+++ sbin/runscript.sh   31 Oct 2004 12:23:08 -0000
@@ -131,12 +131,9 @@
                        if in_runlevel "${myservice}" "${BOOTLEVEL}" || \
                           in_runlevel "${myservice}" "${mylevel}"
                        then
-                               local netcount="$(ls -1 "${svcdir}"/started/net.* 2> /dev/null | \
-                                       grep -v 'net\.lo' | egrep -c "\/net\.[[:alnum:]]+$")"
-
                                # Only worry about net.* services if this is the last one running,
                                # or if RC_NET_STRICT_CHECKING is set ...
-                               if [ "${netcount}" -lt 1 -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
+                               if is_net_up
                                then
                                        mydeps="net"
                                fi
@@ -276,13 +273,10 @@
                                                # A 'need' dependency is critical for startup
                                                if [ "$?" -ne 0 ] && ineed -t "${myservice}" "${x}" >/dev/null
                                                then
-                                                       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
+                                                       # up and running already, or if RC_NET_STRICT_CHECKING
                                                        # is set ....
-                                                       if [ "${netcount}" -lt 1 -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
+                                                       if is_net_up
                                                        then
                                                                startfail="yes"
                                                        fi