# waiting until the networking is up

## curmudgeon

I am sure this has been asked before (though my searching didn't find it).

Is there some way of delaying a service starting until the network connection is established? It seems that in order to get the boot processed finished quickly, more things run at once now, with adverse consequences.

This is an example of ntp-client failing, because the network is not ready:

```

Jun 25 02:01:56 system /etc/init.d/ntp-client[1002]: ERROR: ntp-client failed to start

Jun 25 02:01:57 system Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Jun 25 02:02:01 system kernel: [   17.953644] iwl3945 0000:0c:00.0: loaded firmware version 15.32.2.9

Jun 25 02:02:01 system kernel: [   18.017797] iwl3945 0000:0c:00.0: Error setting Tx power (-5).

Jun 25 02:02:01 system kernel: [   18.019396] ADDRCONF(NETDEV_UP): wlan0: link is not ready

Jun 25 02:02:10 system dhcpcd[1082]: dhcpcd not running

Jun 25 02:02:11 system kernel: [   27.864287] iwl3945 0000:0c:00.0: Error setting Tx power (-5).

Jun 25 02:02:11 system kernel: [   27.866002] ADDRCONF(NETDEV_UP): wlan0: link is not ready

Jun 25 02:02:11 system dhcpcd[1088]: dhcpcd not running

Jun 25 02:02:11 system kernel: [   28.036405] ADDRCONF(NETDEV_UP): eth0: link is not ready

Jun 25 02:02:11 system dhcpcd[1095]: dhcpcd not running

Jun 25 02:02:11 system kernel: [   28.134290] iwl3945 0000:0c:00.0: Error setting Tx power (-5).

Jun 25 02:02:11 system kernel: [   28.135878] ADDRCONF(NETDEV_UP): wlan0: link is not ready

Jun 25 02:02:14 system kernel: [   31.772648] wlan0: authenticate with 00:11:22:33:44:55 (try 1)

Jun 25 02:02:14 system kernel: [   31.774482] wlan0: authenticated

Jun 25 02:02:14 system kernel: [   31.775610] wlan0: associate with 00:11:22:33:44:55 (try 1)

Jun 25 02:02:14 system kernel: [   31.778053] wlan0: RX AssocResp from 00:11:22:33:44:55 (capab=0x431 status=0 aid=3)

Jun 25 02:02:14 system kernel: [   31.778060] wlan0: associated

Jun 25 02:02:14 system kernel: [   31.779625] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

Jun 25 02:02:15 system dhcpcd[1114]: version 5.2.12 starting

Jun 25 02:02:15 system dhcpcd[1114]: wlan0: broadcasting for a lease

Jun 25 02:02:15 system dhcpcd[1114]: wlan0: offered 192.168.0.2 from 192.168.0.1

Jun 25 02:02:18 system dhcpcd[1114]: wlan0: acknowledged 192.168.0.2 from 192.168.0.1

Jun 25 02:02:18 system dhcpcd[1114]: wlan0: checking for 192.168.0.2

Jun 25 02:02:23 system dhcpcd[1114]: wlan0: leased 192.168.0.2 for 86400 seconds

```

Obviously, it doesn't make sense (at least to me) trying to start ntp-client until wlan0 is ready (and configured).

----------

## Hu

Have you tried setting ntp-client to need net.wlan0?  This will ensure that ntp-client does not start until net.wlan0 is started and ntp-client stops before net.wlan0 stops.  Many of the network related services by default need net.  However, depending on how you have set the strict networking check, you may find that need net is satisfied by an interface that does not provide adequate connectivity (i.e. a LAN only interface when the underlying service needs Internet access).

----------

## curmudgeon

 *Hu wrote:*   

> Have you tried setting ntp-client to need net.wlan0?  This will ensure that ntp-client does not start until net.wlan0 is started and ntp-client stops before net.wlan0 stops.

 

I didn't know that was possible, but it wouldn't the problem completely. Sometimes the machine (selected via grub entry) starts a profile that uses ethernet (net.eth0) instead of wireless. Then ntp-client would be forever waiting for the wireless network to come up.

----------

## Hu

You did not specify that.  :Wink:   What is the current value of RC_NET_STRICT_CHECKING?  Have you tried setting it to "no" (if that is not its current value)?

----------

## curmudgeon

 *Hu wrote:*   

> What is the current value of RC_NET_STRICT_CHECKING?  Have you tried setting it to "no" (if that is not its current value)?

 

Assuming that mean in /etc/rc.conf (I don't know of any other place to look), that variable is not mentioned at all. OK. I guess it is in the old (deprecated) baselayout 1 /etc/conf.d/rc.

1. Does this variable still work with baselayout 2 (meaning can I add it to /etc/rc.conf)?

2. Actually, I still don't think that would fix this due to another issue. I am using wicd on this machine (for a very non-technical user), and for some reason (translation: because I don't know how to configure it correctly), it is bringing up eth0 even when it makes a wireless connection. It sounds like if I can figure out how to prevent that, it might just work as is.

----------

## Hu

That is its baselayout-1 name, but it exists in baselayout-2, as rc_depend_strict.

Have you installed net-misc/ifplugd?

----------

