# ntp won't start [SOLVED]

## deno

Hi!

I have problems with ntp-client and ntpd services. they want start because they are waiting for net.eth0  to be started. The problem is that eth0 is my wired interface and I usualy use ath0 (wireless).

This is depend() function from ntp-client: *Quote:*   

> depend() {
> 
>  7         before cron portmap
> 
>  8         need net
> ...

 

Inspite that I am continuously getting the same warning:  *Quote:*   

> WARNING: ntp-client  is schedule to start when net.eth0 has started

 

I am getting the same message for ntpd also. depend() from ntpd: *Quote:*   

> depend() {
> 
>         need net
> 
>         use dns logger
> ...

 Last edited by deno on Mon Apr 21, 2008 8:25 pm; edited 1 time in total

----------

## electronvolt

try setting rc_depend_strict="NO" in /etc/rc.conf

```

# Do we allow any started service in the runlevel to satisfy the depedency

# or do we want all of them regardless of state? For example, if net.eth0

# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"

# both will be started, but services that depend on 'net' will work if either

# one comes up. With rc_depend_strict="YES" we would require them both to

# come up.

rc_depend_strict="NO"

```

/edit this assumes you are using baselayout-2 and the problem came about after upgrading

----------

## deno

Yup baselayout-2. Thanks for the solution elektronvolt  :Smile: . Btw. I find it's a little bit strange that default setting is "YES".

----------

## electronvolt

me too....guess the Devs have a (good?) reason for it though...I only found that option looking through rc.conf to solve another little niggly problem after upgrading to baselayout-2. Oh well, c'est la vie!

----------

## shrtckt

 *Quote:*   

> try setting rc_depend_strict="NO" in /etc/rc.conf 

 

This does allow ntpd to start. However, other issues are present if your system also uses ntp-client. As you know, the init script in /etc/init.d/ntpd sets the variable "after ntp-client." If ntp-client does not start or remain a rc-status of "scheduled," then ntpd will not actually adjust the machines time clock - even though ntpd is up and running. The issue I'm digging at is ntp-client still looks for eth0, and will not fire up when wlan0 becomes active like ntp now does. If the user requests a start (/etc/init.d/ntp-client start,) then ntp-client will start (using wlan0) and set the clock with no returned errors. Then, ntpd will actually start adjusting the time sync. In a nutshell, I'm having trouble getting ntp-client to look for wlan0 being "up" instead of just eth0. Does anyone else see this issue? 

(baselayout II / amd64 HP Pavilion dv5000)

----------

## alphacube

Check out this thred 

https://forums.gentoo.org/viewtopic-t-688186.html

----------

## deno

shrtckt, have you tried to change 'after net.eth0' with 'after net.wlan0' in ntp-client?

I have also tried with 'after net.ath0 || net.eth0' and ntp-clients starts here in both cases.

----------

## deno

Or try removing after line from depend() in ntp-client. If you have it at all... I am not sure if I put i there or it is there per defaut.

----------

## shrtckt

 *deno wrote:*   

> shrtckt, have you tried to change 'after net.eth0' with 'after net.wlan0' in ntp-client?
> 
> I have also tried with 'after net.ath0 || net.eth0' and ntp-clients starts here in both cases.

 

Thanks deno  :Smile:  I owe you a beer!

For others who may want the fix that worked for me...

```
sss@node1 /etc/init.d $ cat ntp-client

#!/sbin/runscript

# Copyright 1999-2007 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntp-client.rc,v 1.11 2007/03/09 17:24:28 vapier Exp $

depend() {

        before cron portmap

#       need net

        after net.wlan0 || after net.eth0

        use dns logger

}

checkconfig() {

        if ! type "${NTPCLIENT_CMD}" >/dev/null 2>/dev/null ; then

                eerror "Please edit /etc/conf.d/ntp-client"

                eerror "Unable to locate the client command ${NTPCLIENT_CMD}!"

                return 1

        fi

        if [ -z "${NTPCLIENT_OPTS}" ] ; then

                eerror "Please edit /etc/conf.d/ntp-client"

                eerror "I need to know what server/options to use!"

                return 1

        fi

        return 0

}

start() {

        checkconfig || return $?

        ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"

        "${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}

        eend $? "Failed to set clock"

```

NOTE: eth0 is inactive due to the fact that I do not use it and it is controlled by netplug.

Results:

```
sss@node1 /etc/init.d $ rc-status

Runlevel: default

 syslog-ng                                                                                                                                                               [  started  ]

 hdparm                                                                                                                                                                  [  started  ]

 net.eth0                                                                                                                                                                [ inactive  ]

 net.wlan0                                                                                                                                                               [  started  ]

 netmount                                                                                                                                                                [  started  ]

 xdm                                                                                                                                                                     [  started  ]

 ntp-client                                                                                                                                                              [  started  ]

 ntpd                                                                                                                                                                    [  started  ]

 sshd                                                                                                                                                                    [  started  ]

 atieventsd                                                                                                                                                              [  started  ]

 postfix                                                                                                                                                                 [  started  ]

 vixie-cron                                                                                                                                                              [  started  ]

 local                                                                                                                                                                   [  started  ]

Runlevel: UNASSIGNED

 udev-postmount             
```

ntpd...

```
sss@node1 /etc/init.d $ ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

+tock.usno.navy. .USNO.           1 u   18   64  377   40.008    2.946   6.542

*NAVOBS1.MIT.EDU .PSC.            1 u   17   64  377   36.257   -1.401   2.081

```

rebooted 15x, and success 100%.  :Smile: 

----------

