# ntp-client: "Name or service not known" at boot

## the_maddin

Hello!

I get the following message at boot-up "Error: Name or service not known". 

The failure comes from ntp-client, in /var/log/messages I find the following:

```
Jul 18 21:18:20 martin ntpdate[7260]: can't find host de.pool.ntp.org

Jul 18 21:18:20 martin ntpdate[7260]: no servers can be used, exiting
```

I'm rather confused, because all network is up long before, the only daemons, which are started afterwards are sshd, numlock and the powersaved. Moreover, RC_PARALLEL_STARTUP="no". When I log in as root just 2 secs after this error-message (when the system is up), I can issue /etc/init.d/ntp-client start without any error messages following...  :Sad: 

A simple sleep 3; in /etc/init.d/ntp-client doesn't help anything.

What should I do?

Thanks a lot in advance

Martin

----------

## xalan

In your  /etc/init.d/ntp-client, please edit the depends section as following:

```

depend() {

       before cron portmap

       need net

       after net.eth0

       use dns logger

}

```

net.eth0 assumes that eth0 is your default networking device. Change it accordingly and see if the new dependency works. Even with this, it might be possible for networking script to complete before the networking device is completely up and running.

http://gentoo-wiki.com/HOWTO_NTP

----------

## the_maddin

I tried the change in ntp-client, but it doesn't help. 

The hint with the postup in the ntp-howto helped me.

I now enabled the parallel boot (decreased boot-time abt 5 secs). ntp-client doesn't produce any errors at first time, but I am going to watch it some time longer.

Thanks for the help!

Martin

----------

## the_maddin

Hi!

The problem still exists. After a reboot it works several times. But after 2 hours, when my DSL-router disconnects itself, the problem occurs.

Is it possible to send a ping before or to resolve an other hostname to wake the router up earlier?

I now tried another thing: I don't let my router (Netgear RP614v2) get the dns servers automatically, I just defined some dns-servers.

Maybe the problem is that fetching two dns-servers lasts longer than applying two defined dns-servers.

You'll hear from me  :Wink: 

Martin

----------

## newtonian

Had the same error.  Turns out that my machine wasn't connected to the Internet.

After getting networking setup correctly the errors went away.

Cheers,

----------

## kimmie

As you say, if your router is disconnected from the net, that's probably it. It's true that using the dns relay is slightly slower, but it really shouldn't cause this sort of problem. 

Unless there's some particular reason you want the auto-disconnect happening, turning it off should fix the problem.

You could do something in a postup() function in /etc/conf.d/net to wake the router and give it time to connect... see /usr/share/doc/openrc-*/net.example. Using ping in a loop until it succeeds or reaches a retry limit should work.

----------

## kimmie

A better solution: if you just use ntpd instead of ntp-client it will work around this for you... it can handle interfaces being up or down, and failed DNS lookups. You don't need to run ntp-client. You can use the -g option to ntpd in /etc/conf.d/ntpd to allow it to jump the time on startup, like ntp-client would.

----------

