Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ntpdate[4850]: can't find host 0
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
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Sun Jan 31, 2010 10:15 am    Post subject: ntpdate[4850]: can't find host 0 Reply with quote

Hi,

I get the following error during startup:
Code:
# grep ntp /var/log/messages
Jan 31 10:32:40 gentoo ntpdate[4850]: can't find host 0.gentoo.pool.ntp.org
Jan 31 10:32:40 gentoo ntpdate[4850]: can't find host 1.gentoo.pool.ntp.org
Jan 31 10:32:40 gentoo ntpdate[4850]: can't find host 2.gentoo.pool.ntp.org
Jan 31 10:32:40 gentoo ntpdate[4850]: can't find host 3.gentoo.pool.ntp.org
Jan 31 10:32:40 gentoo ntpdate[4850]: no servers can be used, exiting

My init-scripts are configured as follows:
Code:
# rc-update show
           alsasound | boot
             apache2 |      default
            bootmisc | boot
             checkfs | boot
           checkroot | boot
               clock | boot
         consolefont | boot
               cupsd |      default
                dbus |      default
          fbcondecor | boot
                hald |      default
            hostname | boot
             keymaps | boot
               local |      default nonetwork
          localmount | boot
             modules | boot
               mysql |      default
         mythbackend |      default
              net.lo | boot
            netmount |      default
          ntp-client |      default
           rmnologin | boot
              serial | boot
           syslog-ng |      default
             urandom | boot
          vixie-cron |      default
                wicd | boot
                 xdm |      default
              xinetd |      default

And /etc/init.d/ntp-client is adjusted in the following way:
Code:
depend() {
        before cron portmap
#       need net
        after net.wlan0 || after net.eth0
        use dns logger
}

After login I can successfully start ntp-client. It seems like ntp-client is running in timeout during boot.
Back to top
View user's profile Send private message
Ato
n00b
n00b


Joined: 22 Dec 2007
Posts: 66
Location: Duisburg, Germany

PostPosted: Sun Jan 31, 2010 2:55 pm    Post subject: Reply with quote

It seems that you have no network interface up but lo when ntp starts. Perhaps you want to add something like net.eth0 or net.wlan0 to the boot or default levels.

Cheers,
T.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Feb 01, 2010 6:09 am    Post subject: Reply with quote

There's a crazy contradiction with ntp starting before logging. Logging wants to know the right time, but networking (and BIND, if you're using BIND to name-resolve) needs to be up to be able to name-resolve and contact the timeservers :P

At one point, I resolved this startup order paradox between ntp and bind, by having in /etc/ntp.conf
Code:
# From http://www.pool.ntp.org/zone/th
server 2.th.pool.ntp.org prefer
server 3.asia.pool.ntp.org
server 2.asia.pool.ntp.org

Notice that "prefer". And in /etc/hosts
Code:
# For ntp at startup, because it starts before bind/named
158.108.2.100   2.th.pool.ntp.org

Not perfect, but it works.
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Mon Feb 01, 2010 6:38 pm    Post subject: Reply with quote

My settings look like this:
Code:
# cat /etc/ntp.conf
# Generated by dhclient for interface eth0
restrict default noquery notrust nomodify
restrict 127.0.0.1
restrict 192.168.178.1 nomodify notrap noquery
server 192.168.178.1
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

Code:
# cat /etc/hosts
127.0.0.1 gentoo.home gentoo localhost
::1 localhost

How can I check, if I use BIND?

I wonder about /etc/ntp.conf, because I don't use dhclient but static IP's
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Fri Feb 05, 2010 5:35 pm    Post subject: Reply with quote

I've changed ntp.conf like this:
Code:
# cat /etc/ntp.conf                     
# NOTES:                                               
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.                   

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server         ntp.example.tld         iburst                         

# Common pool for random people
#server pool.ntp.org           

# Pools for Gentoo users
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile       /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# To deny other machines from changing the
# configuration but allow localhost:
restrict default nomodify nopeer
restrict 127.0.0.1


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap

But I get the some errors.
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Sat Feb 06, 2010 11:32 am    Post subject: Reply with quote

I've changed my settings as follows:
Code:
# cat /etc/hosts
127.0.0.1 gentoo.home gentoo localhost
::1 localhost
64.73.32.135 0.gentoo.pool.ntp.org
67.22.149.171 1.gentoo.pool.ntp.org
72.18.205.156 2.gentoo.pool.ntp.org
169.229.70.95 3.gentoo.pool.ntp.org

Code:
# cat /etc/ntp.conf                                             
# NOTES:                                                                     
# DHCP clients can append or replace NTP configuration files.                 
# You should consult your DHCP client documentation about its                 
# default behaviour and how to change it.                                     

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server         ntp.example.tld         iburst                         

# Common pool for random people
#server pool.ntp.org           

# Pools for Gentoo users
server 0.gentoo.pool.ntp.org prefer
server 1.gentoo.pool.ntp.org       
server 2.gentoo.pool.ntp.org       
server 3.gentoo.pool.ntp.org       

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile       /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# To deny other machines from changing the
# configuration but allow localhost:
restrict default nomodify nopeer
restrict 127.0.0.1


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap

But I'm still getting the following error:
Code:
# grep ntp /var/log/messages
Feb  6 12:17:11 gentoo ntpdate[4943]: no servers can be used, exiting
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Sun Feb 14, 2010 5:34 pm    Post subject: Reply with quote

Problem is still pending. Could someone help?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Feb 14, 2010 11:45 pm    Post subject: Reply with quote

Look at Ato's answer. Ntp needs access to the Internet, of course - you've not shown that you're providing that.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1698

PostPosted: Mon Feb 15, 2010 11:42 am    Post subject: Reply with quote

Try and ping one of the ntp servers. If ping works, its probably a problem
with ntp - possibly your machine's time is too far from the standard for
ntp to want to reset it. If ping doesn't work, then use ifconfig to see how
your networking is configured and post the results.

Will
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Mon Feb 15, 2010 6:14 pm    Post subject: Reply with quote

ping works correctly.
Code:
# ping -c 5 0.gentoo.pool.ntp.org
PING 0.gentoo.pool.ntp.org (64.73.32.135) 56(84) bytes of data.
64 bytes from 0.gentoo.pool.ntp.org (64.73.32.135): icmp_seq=1 ttl=51 time=171 ms
64 bytes from 0.gentoo.pool.ntp.org (64.73.32.135): icmp_seq=2 ttl=51 time=171 ms
64 bytes from 0.gentoo.pool.ntp.org (64.73.32.135): icmp_seq=3 ttl=51 time=171 ms
64 bytes from 0.gentoo.pool.ntp.org (64.73.32.135): icmp_seq=4 ttl=51 time=170 ms
64 bytes from 0.gentoo.pool.ntp.org (64.73.32.135): icmp_seq=5 ttl=51 time=173 ms

--- 0.gentoo.pool.ntp.org ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4015ms
rtt min/avg/max/mdev = 170.769/171.770/173.774/1.178 ms

And also ntpd works correctly when I start it manually at command promt.
Code:
# /etc/init.d/ntpd start
 * Starting ntpd ...                                                                                                   [ ok ]

Maybe the connection is established to late. Could I modify the timeout setting of ntp?
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 444

PostPosted: Thu Feb 25, 2010 5:50 pm    Post subject: Reply with quote

Please read this topic
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