Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
is there a way to prevent an init script from backgrounding?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Sat Aug 16, 2008 9:21 pm    Post subject: is there a way to prevent an init script from backgrounding? Reply with quote

Hi Folks,

on my Laptop my wireless network starts up with that messages

Code:

 * Bringing up interface eth1
 *   Starting wpa_supplicant on eth1 ...                                                                                       [ ok ]
 *   Starting wpa_cli on eth1 ...                                                                                              [ ok ]
 *   Backgrounding ... ...
 * WARNING: net.eth1 not under our control, aborting


i figured out that the "WARNING: ..." message is because of using wpa_supplicant so i can ignore it. i got an ip (yes thats good but it takes some time) and the boot process continues with messages like "sshd would be startet when net.eth1 has started" and /etc/init.d/net.eth1 status tells me somtimes a long long time that the interface is inactive (and the interface already have an ip adress and i can query the net and use irc) and therefor no network depending daemon has been started. i think thats not the best way.
so is there a way to tell my net.* init script to wait until the interface gets an IP adress?

all interfaces are using dhcpcd for querying for ip.

the variables [set in /etc/conf.d/net ] (here for testing purposes to 60 seconds set)

Code:
wpa_timeout_eth1=60
plug_timeout_eth1=60


Won't work for me

are there others i don't realize on my search in all the net.example files? (that one in conf.d and that one in the /usr/...../openrc/.... directory )

kind regards
Gnom

p.s. if you need more informations ... ask for it and you'll get it!
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Sun Aug 17, 2008 2:32 pm    Post subject: Re: is there a way to prevent an init script from background Reply with quote

I have a similar set up on my laptop and I don't get "not under our control" style messages.

Could you post your /etc/conf.d/net file please?

Do you have ifplugd installed?

Cheers
Jon
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Sun Aug 17, 2008 6:31 pm    Post subject: Reply with quote

Hi gerdesj,

yes i have ifpluged installed but disabled for eth1.

here the /etc/conf.d/net
Code:

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

#allgemein
timeout_eth0="10"

#lan ab hier
#daheim
config_eth0="dhcp"
dhcp_eth0="nonis"
fallback_eth0="192.168.0.31 netmask 255.255.255.0 brd 192.168.0.255"
fallback_route_eth0="default via 192.168.0.1"
fallback_dns_servers_eth0="192.168.0.1 192.168.0.10"

#wlan ab hier
#daheim / at home
config_netz123="dhcp"
dhcp_netz123="nonis"


#default
config_eth1="dhcp"
dhcp_eth1="nonis"

#allgemeines wlan
modules_eth1="wpa_supplicant !ifplugd"
wpa_supplicant_eth1="-D wext"
wpa_timeout_eth1=60
plug_timeout_eth1=30

#starten verhindern wenn eth0 online
# preup not working on openrc/baselayout 2 so commented out
#preup () { ! [ "$1" = "eth1" -a -e /var/lib/init.d/started/net.eth0 ]; }
# postup is for switching on the LED of my notebook
postup ()
 {
  if [ "$1" = "eth1" ];
  then
    ebegin "schalte LED ein"
       echo 1 >> /sys/devices/pci0000\:00/0000\:00\:1e.0/0000\:02\:04.0/led
    eend $?
  fi
  return 0;
 }


kind regards
Gnom

p.s. i'm a german guy so ignore the german comments :-)
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Sun Aug 17, 2008 10:31 pm    Post subject: Reply with quote

I'll show you mine if you show me yours!:

Code:

# -----------------------------------------------------------------------------------
# /etc/conf.d/net
# jglaptop
# JG 13 Jan 2007
# -----------------------------------------------------------------------------------

modules="iproute2" "dhcpcd" "wpa_supplicant"

wpa_supplicant_wlan0="-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf"

config_lan0="dhcp"
config_fire0="null"
config_wlan0="dhcp"

# Home wireless
config_roseandjon="192.168.200.100/24"
dns_servers_roseandjon="127.0.0.1"
dns_domain_roseandjon="roseandjon.plus.com"
dns_search_roseandjon="roseandjon.plus.com blueloop.net"
routes_roseandjon="default via 192.168.200.1"


Please excuse the English comments, my surname is German but my family have been British for 500 years or so! I like the use of postup to turn on an LED in your config - good nerdy stuff.

Now, we need to get to the bottom of why your WiFi interface - eth1 takes so long to come up.

What type of card do you have?
What is the content of your wpa_supplicant.conf?
What type of router do you have?

Cheers
Jon
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Mon Aug 18, 2008 6:34 pm    Post subject: Reply with quote

Thanks for the "nerdy Stuff" ;-)

first i wanna use the preup() but thats already in use ... so i can't

so here comes what you wanna know:

gerdesj wrote:
What type of card do you have?

Code:

# lspci
{snip}
02:04.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05)
{snip}


gerdesj wrote:
What is the content of your wpa_supplicant.conf?

Code:

# cat /etc/wpa_supplicant/wpa_supplicant.conf
# This is a network block that connects to any unsecured access point.
# We give it a low priority so any defined blocks are preferred.
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1

network={
  ssid="netz123"
  psk="{snip}" # i think thats all you wanna know ;-)
  priority=5
  proto=WPA
  scan_ssid=1
  key_mgmt=WPA-PSK
  pairwise=TKIP
  group=TKIP
 }

network={
  ssid="{snip}" #ssid from a friends AP
  psk="{snip}" # his psk :-)
  priority=5
  proto=WPA
  scan_ssid=1
  key_mgmt=WPA-PSK
  pairwise=TKIP
  group=TKIP
 }
network={
        key_mgmt=NONE
        priority=-9999999
}

gerdesj wrote:
What type of router do you have?

err ... i got a D-Link router but i don't think that matters here because it havent any WiFi Stuff onboard.
my Accesspoint is a LinkSys WAP54G

Cheers
Gnom
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Wed Aug 20, 2008 8:39 am    Post subject: Reply with quote

Code:

modules_eth1="wpa_supplicant !ifplugd"


The !ifplugd causes the error message not using wpa_supplicant. Then because you have turned off plug, the timeouts wont work.

You are using OpenRC so the example file is in /usr/share/doc/openrc/net.example (I symlink it back to /etc/conf.d/net.example on all my Gentoo boxes)

This might help:

Code:

plug_timeout="10"
# A value of 0 means wait forever.


So I suggest that you drop the !ifplugd and use plug_timeout="0" then its a case of fixing up wpa_supplicant.

Just in case it helps, here is my wpa_supplicant.conf:

Code:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0

eapol_version=2
ap_scan=1
fast_reauth=1

network={
        ssid="roseandjon"
        psk="xxxxxxxxxxxxx"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        scan_ssid=1
        priority=1
}

network={
        ssid="blueloophq"
        psk="xxxxxxxxxxxxx"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        scan_ssid=1
        priority=2
}

network={
        ssid="gerdes"
        psk="xxxxxxxxxxxxxx"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        scan_ssid=1
        priority=3
}

# Final default, will connect to nearly anything
network={
        key_mgmt=NONE
        priority=-9999999
}


I have a couple of extra settings but I notice that we are both using WPA-PSK so they may help. The examples with wpa-sup0plicant are very detailed so there may be some more help there.

It is worth checking "dmesg" it when your WiFi comes up also running #wpa_cli might give some helpful information.

Cheers
Jon
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Wed Aug 20, 2008 8:22 pm    Post subject: Reply with quote

sooo got bad news ... plug_timeout="0" won't work.

also get

Code:

# /etc/init.d/net.eth1 restart
 * Bringing down interface eth1
 *   Stopping dhcpcd on eth1 ...                                                                                              [ ok ]
 *   Removing addresses
 *     Stopping wpa_cli on eth1 ...                                                                                           [ ok ]
 *     Stopping wpa_supplicant on eth1 ...                                                                                    [ ok ]
 * Bringing up interface eth1
 *   Starting wpa_supplicant on eth1 ...                                                                                      [ ok ]
 *   Starting wpa_cli on eth1 ...                                                                                             [ ok ]
 *   Backgrounding ... ...
 * WARNING: net.eth1 not under our control, aborting


the dmesg after /etc/init.d/net.eth1 restart

Code:

eth1: no IPv6 routers present
ADDRCONF(NETDEV_UP): eth1: link is not ready
ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
eth1: no IPv6 routers present


wpa_cli:

Code:

> status verbose
bssid=xx:xx:xx:xx:xx:xx
ssid=netz123
id=0
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.0.32


any more ideas?

the problem exists since using openRC ... before openRC it workes with the timeout configs ...

a found a Bug (a OLD bug ... wher the same problem exists ... ) https://bugs.gentoo.org/show_bug.cgi?id=196029

i tried every thing in the bug bot nothing workes ...

cheers
Gnom
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Wed Aug 20, 2008 10:35 pm    Post subject: Reply with quote

OK, using my working one as a model:

I have baselayout-2.0.0, openrc-0.2.5, wpa_supplicant-0.5.10, dhcpcd-4.0.0_rc4

Could you change your /etc.conf.d/net to something like this:

Code:

modules="iproute2" "dhcpcd" "wpa_supplicant"

wpa_supplicant_eth10="-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf"

config_lan1="dhcp"


ie explicitly state the wpa_supplicant stuff in here. make sure your -c is correct.

Also, you do have a symlink to net.lo for net.eth1 in /etc/init.d don't you? Also net.eth1 is added to default runlevel.

Cheers
Jon
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Thu Aug 21, 2008 7:20 pm    Post subject: Reply with quote

Code:

# ls -la /etc/init.d/net.eth1
lrwxrwxrwx 1 root root 6 26. Feb 22:12 /etc/init.d/net.eth1 -> net.lo


i got:
- the same baselayout
- the same openrc
- the same wpa_supplicant
- different dhcpcd (4.0.0_rc5) <-- trying to downgrade and test ( don't work :-( )

so changed my config file ...

now i got on every restart of the network interface the huge usage page from wpa_supplicant

Code:

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#allgemein
#timeout_eth0="10"
modules="dhcpcd" "wpa_supplicant"
#lan ab hier

#daheim
config_eth0="dhcp"
dhcp_eth0="nonis"
fallback_eth0="192.168.0.31 netmask 255.255.255.0 brd 192.168.0.255"
fallback_route_eth0="default via 192.168.0.1"
fallback_dns_servers_eth0="192.168.0.1 192.168.0.10"

#wlan ab hier
# --- daheim
config_netz123="dhcp"
dhcp_netz123="nonis"
# --- default
config_eth1="dhcp"
dhcp_eth1="nonis"

#allgemeines wlan
#modules_eth1="wpa_supplicant"
#wpa_supplicant_eth1="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf" <-- workes not yes config file iss right ...  see below
wpa_supplicant_eth1="-Dwext"            <-- the old line ... won't work too ...
#wpa_timeout_eth1=60
#plug_timeout=0


Code:

# ls -la /etc/wpa_supplicant/
insgesamt 16
drwxr-xr-x  2 root root 4096 16. Aug 16:31 .
drwxr-xr-x 75 root root 4096 21. Aug 21:17 ..
-rwxr-xr-x  1 root root 1312 16. Aug 22:46 wpa_cli.sh
-rw-r--r--  1 root root  656 15. Aug 18:46 wpa_supplicant.conf


any ideas?

cheers
Gnom

[edit]hmm i forget to write ... the startup/stop message is the same as in my previous post[/edit]
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Fri Aug 22, 2008 8:49 pm    Post subject: Reply with quote

Could you check to see if #etc-update has anything left to do?

In the meantime I'll try to find time to dig through this whole thread.

Cheers
Jon
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Fri Aug 22, 2008 9:03 pm    Post subject: Reply with quote

Checked

and nothing found (as expected from my side)

kind regards
Gnom
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
f4u5t
n00b
n00b


Joined: 09 Jul 2008
Posts: 45

PostPosted: Fri Aug 22, 2008 10:23 pm    Post subject: Reply with quote

Based on

https://forums.gentoo.org/viewtopic-p-5090768-highlight-associatetimeout.html#5090768

I think there is no way to easily accomplish what you want to do.

Neither ifplugd nor netplug will work.

Ifplugd says:

Quote:

Have a look on waproamd if you need a facility to configure WEP keys before AP associations succeed


The home page for waproamd says

Quote:

waproamd is obsolete, please use wpa_supplicant instead. waproamd contains some race conditions that are impossible to fix. wpa_supplicant supersedes waproamd in almost every way.


and doesn't seem to support wpa

netplug only works with wired networks.

/usr/share/doc/openrc/net.example is wrong

There is no associate_timeout_<if>.

You could fix it by hacking /lib/rc/net/wpa_supplicant.sh

Look in the function wpa_supplicant_pre_start and search for

Code:

        ebegin "Starting wpa_cli on" "${IFACE}"
        start-stop-daemon --start --exec "${wpac}" \
                --pidfile "/var/run/wpa_cli-${IFACE}.pid" \
                -- -a "${actfile}" -p "${ctrl_dir}" -i "${IFACE}" \
                -P "/var/run/wpa_cli-${IFACE}.pid" -B
        if eend $?; then
                ebegin "Backgrounding ..."
                exit 1
        fi


The fix would be to change that "if eend $?; then" to go into a loop waiting for association which is what the pre-OpenRC scripts. Pehaps that code could be adapted. I may look into that.
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Sat Aug 23, 2008 10:18 pm    Post subject: Reply with quote

hi f4u5t,

thanks for the hints. did you have an idea what i have to change there?

cheers
gnom
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
f4u5t
n00b
n00b


Joined: 09 Jul 2008
Posts: 45

PostPosted: Mon Aug 25, 2008 3:19 am    Post subject: Reply with quote

K_O-Gnom wrote:
hi f4u5t,

thanks for the hints. did you have an idea what i have to change there?

cheers
gnom


I whipped up this patch to add associate_timeout_<iface>=<int> to /etc/conf.d/net (when using the wpa_supplicant module) where -1 = background (how it works now), 0 = infinite and any other number is the timeout.

http://www.lanfear.net/~mark/stuff/openrc_wpa_supplicant_assoc_timeout.patch

It works for me and I'm disinclined to support it. If you don't know how to apply patches you may wish to ignore it.

Code:

--- /lib/rc/net/wpa_supplicant.sh.dist   2008-06-06 16:39:59.000000000 -0700
+++ /lib/rc/net/wpa_supplicant.sh   2008-08-24 19:58:29.000000000 -0700
@@ -16,6 +16,32 @@
    after iwconfig
 }
 
+# bool wpa_supplicant_associated(char *interface)
+#
+# Returns 0 if we're associated correctly or 1 if not
+# Note that just because we are associated does not mean we are using the
+# correct encryption keys
+_wpa_supplicant_associated() {
+   local -a status=()
+   eval status=( $(wpa_cli -i"$1" status \
+      | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p')
+   )
+
+   case "${status[0]}" in
+      "NONE")
+         [[ ${status[1]} == "ASSOCIATED" || ${status[1]} == "COMPLETED" ]]
+         ;;
+      "IEEE 802.1X (no WPA)")
+         [[ ${status[2]} == "SUCCESS" ]]
+         ;;
+      *)
+         [[ ${status[1]} == "COMPLETED" ]]
+         ;;
+   esac
+
+   return $?
+}
+
 # Only set these functions if not set already
 # IE, prefer to use iwconfig
 if ! type _get_ssid >/dev/null 2>&1; then
@@ -45,9 +71,10 @@
 
 wpa_supplicant_pre_start()
 {
-   local opts= cfgfile= ctrl_dir= wireless=true
+   local opts= cfgfile= ctrl_dir= wireless=true timeout=
    local wpas=/usr/sbin/wpa_supplicant wpac=/usr/bin/wpa_cli
    local actfile=/etc/wpa_supplicant/wpa_cli.sh
+   local actfile_noop=/etc/wpa_supplicant/wpa_cli_noop.sh
 
    if [ ! -x "${wpas}" ]; then
       wpas=/sbin/wpa_supplicant
@@ -62,6 +89,9 @@
       *) _is_wireless || return 0;;
    esac
 
+   eval timeout=\$associate_timeout_${IFVAR}
+   timeout=${timeout:--1}
+
    # We don't configure wireless if we're being called from
    # the background unless we're not currently running
    if yesno ${IN_BACKGROUND}; then
@@ -141,20 +171,51 @@
       return 0
    fi
 
-   # Starting wpa_supplication-0.4.0, we can get wpa_cli to
-   # start/stop our scripts from wpa_supplicant messages
-   local inact=false
-   service_inactive && inact=true
-   mark_service_inactive
-
    ebegin "Starting wpa_cli on" "${IFACE}"
-   start-stop-daemon --start --exec "${wpac}" \
-      --pidfile "/var/run/wpa_cli-${IFACE}.pid" \
-      -- -a "${actfile}" -p "${ctrl_dir}" -i "${IFACE}" \
-      -P "/var/run/wpa_cli-${IFACE}.pid" -B
-   if eend $?; then
-      ebegin "Backgrounding ..."
-      exit 1
+
+   if [[ ${timeout} -lt 0 ]] ; then
+
+      # Starting wpa_supplication-0.4.0, we can get wpa_cli to
+      # start/stop our scripts from wpa_supplicant messages
+      local inact=false
+      service_inactive && inact=true
+      mark_service_inactive
+
+      start-stop-daemon --start --exec "${wpac}" \
+         --pidfile "/var/run/wpa_cli-${IFACE}.pid" \
+         -- -a "${actfile}" -p "${ctrl_dir}" -i "${IFACE}" \
+         -P "/var/run/wpa_cli-${IFACE}.pid" -B
+      if eend $?; then
+         ebegin "Backgrounding ..."
+         exit 1
+      fi
+   else
+      start-stop-daemon --start --exec "${wpac}" \
+         --pidfile "/var/run/wpa_cli-${IFACE}.pid" \
+         -- -a "${actfile_noop}" -p "${ctrl_dir}" -i "${IFACE}" \
+         -P "/var/run/wpa_cli-${IFACE}.pid" -B \ > /dev/null 2>&1
+
+      if [[ ${timeout} -eq 0 ]] ; then
+         einfo "infinite timeout set for association on ${IFVAR}"
+      else
+         einfo "timeout set for association on ${IFVAR}: ${timeout}"
+      fi
+
+      local i=0
+      while true ; do
+         if ! wpa_cli -i"${IFACE}" status &>/dev/null ; then
+            ewarn "wpa_supplicant has exited unexpectedly"
+            return 1
+         fi
+         if _wpa_supplicant_associated "${IFACE}"; then
+            return 0
+         fi
+         sleep 1
+         [[ ${timeout} == "0" ]] && continue
+         (( i++ ))
+         [[ ${i} == "${timeout}" || ${i} -gt "${timeout}" ]] && break
+      done
+      ewarn "association on ${IFVAR} timeout"
    fi
 
    # wpa_cli failed to start? OK, error here
--- /etc/wpa_supplicant/wpa_cli_noop.sh.dist   2008-08-24 20:07:38.000000000 -0700
+++ /etc/wpa_supplicant/wpa_cli_noop.sh   2008-08-24 20:09:09.000000000 -0700
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright 1999-2006 Gentoo Foundation
+# Written by Roy Marples <uberlord@gentoo.org>
+# Distributed under the terms of the GNU General Public License v2
+# Alternatively, this file may be distributed under the terms of the BSD License
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_cli.sh,v 1.1 2006/07/11 15:07:16 uberlord Exp $
+
+if [ -z "$1" -o -z "$2" ]; then
+   logger -t wpa_cli "Insufficient parameters"
+   exit 1
+fi
+
+INTERFACE="$1"
+ACTION="$2"
+
+# Note, the below action must NOT mark the interface down via ifconfig, ip or
+# similar. Addresses can be removed, changed and daemons can be stopped, but
+# the interface must remain up for wpa_supplicant to work.
+
+if [ -f /etc/gentoo-release ]; then
+   #EXEC="/etc/init.d/net.${INTERFACE} --quiet"
+   EXEC="/etc/init.d/net.${INTERFACE}"
+else
+   logger -t wpa_cli "I don't know what to do with this distro!"
+   exit 1
+fi
+
+logger -t wpa_cli "interface ${INTERFACE} ${ACTION}"
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Mon Aug 25, 2008 9:43 am    Post subject: Reply with quote

Great i'll try it when i'm back home from work.

Thanks

cheers
Gnom
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Sun Sep 07, 2008 3:10 pm    Post subject: Reply with quote

nice ... today i got the time to test the patch

IT WORKES!!!...

so now i only have to try to apply a similar "patch" for the net.eth0 device ... that THAT wont go in background .. or is that already in there an i only have to configure it? [edit]see below p.s.[/edit]

cheers
Gnom

p.s. my eth0 init.d script now gets an IP (with plug_timeout_eth0="0" configured) and then it tells me * WARNING: net.eth1 not under our control, aborting ... that ummm i only can say "workes" ... but it dont really lookes "good" ... i wanna get it working like the "old" way ... waiting for an ip a defined time and abort if it wont get one ... is there a way to get it working like that?

atm the restart process of both interfaces looks like that:
Code:

~ # /etc/init.d/net.eth0 restart
 * Bringing down interface eth0
 *   Stopping dhcpcd on eth0 ...                                                                                                                          [ ok ]
 *   Stopping ifplugd on eth0 ...                                                                                                                         [ ok ]
 *   Removing addresses
 * Bringing up interface eth0
 *   Starting ifplugd on eth0 ...                                                                                                                         [ ok ]
 *     WARNING: infinite timeout set for eth0 to come up
 *     received address 192.168.0.31/24
 * WARNING: net.eth0 not under our control, aborting

# /etc/init.d/net.eth1 restart
 * Bringing down interface eth1
 *   Stopping dhcpcd on eth1 ...                                                                                                                          [ ok ]
 *   Removing addresses
 *     Stopping wpa_cli on eth1 ...                                                                                                                       [ ok ]
 *     Stopping wpa_supplicant on eth1 ...                                                                                                                [ ok ]
 * Bringing up interface eth1
 *   Starting wpa_supplicant on eth1 ...                                                                                                                  [ ok ]
 *   Starting wpa_cli on eth1 ...
 *   timeout set for association on eth1: 20
 *   dhcp ...
 *     Running dhcpcd ...
eth1: dhcpcd 4.0.0-rc4 starting
eth1: hardware address = xx:xx:xx:xx:xx:xx
eth1: DUID = xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
eth1: broadcasting for a lease
eth1: offered 192.168.0.32 from 192.168.0.32
eth1: acknowledged 192.168.0.32 from 192.168.0.32
eth1: checking 192.168.0.32 is available on attached networks
eth1: leased 192.168.0.32 for 21600 seconds                                                                                                               [ ok ]
 *     received address 192.168.0.32/24                                                                                                                   [ ok ]
 *   Running postup ...


and i wanna get eth0 running like eth1 does ... any ideas?

cheers
Gnom (again ;-) )
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
tuam
l33t
l33t


Joined: 04 May 2004
Posts: 765
Location: CGN, Germany

PostPosted: Mon Sep 08, 2008 2:24 pm    Post subject: Re: is there a way to prevent an init script from background Reply with quote

K_O-Gnom wrote:
and therefor no network depending daemon has been started. i think thats not the best way.
so is there a way to tell my net.* init script to wait until the interface gets an IP adress?

Sorry if I interrupt your long thread, but if the quote states your problem, would this help?
Code:
cat /etc/conf.d/rc
<snip>
# RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service.
# The following values are allowed:
#  none  - The 'net' service is always considered up.
#  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="lo"
<snip>

FF,

Daniel
_________________
Logic clearly dictates that the needs of the many outweigh the needs of the few. - Spock
The needs of the one outweigh the needs of the many. - Kirk
I refuse to let arithmetic decide questions like that. - Picard
Back to top
View user's profile Send private message
K_O-Gnom
n00b
n00b


Joined: 01 Nov 2005
Posts: 34

PostPosted: Mon Sep 08, 2008 5:20 pm    Post subject: Reply with quote

Hi Tuam,

yes that helps me for stopping the ssh daemon needing both of the network interfaces up ... (i think i write about that problem in one of the first posts ... ) but i realized that some days before ... and changed it ... but that doesn't change anything about backgrounding of the init.d script.... i really _hate_ that backgrounding of the scripts ... ok the system boots faster ... but what is when it screwes up some other scripts because of the need it running? ... (my preup function would not prevent the wireless lan from getting up if the init.d script from the wired network interface is in "inactive" state ... so everytime i got 2 interface up wich getting the same IP (the dhcp is usually configured to serve both network interfaces the same ip to prevent other network stuff from getting screwed up by a different ip) => that ends in a crash that no network device or one of those (nobody knows which one is faster at the boot time) working ... so i think the best way would be to build in a function like the associate_timeout_${iface} variable wich configures the timeout/backgrounding ... default (if not configured or -1) sould be "go in background" and if configured use infinitive (if 0 [zero]) or the specified timeout ...

thats only my opinion but i think its the best way to let the user choose wich behavior he/she want.

regards
Gnom

p.s. if somebody knows where i can patch that for my own system ... please can you tell me?
thanks
_________________
Because of technical reasons the signature is on the back side of this post.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum