View previous topic :: View next topic |
Author |
Message |
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Sun Jan 31, 2010 10:15 am Post subject: ntpdate[4850]: can't find host 0 |
|
|
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 |
|
|
Ato n00b
Joined: 22 Dec 2007 Posts: 66 Location: Macclesfield, United Kingdom
|
Posted: Sun Jan 31, 2010 2:55 pm Post subject: |
|
|
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 |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Mon Feb 01, 2010 6:09 am Post subject: |
|
|
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
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Mon Feb 01, 2010 6:38 pm Post subject: |
|
|
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Fri Feb 05, 2010 5:35 pm Post subject: |
|
|
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Sat Feb 06, 2010 11:32 am Post subject: |
|
|
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Sun Feb 14, 2010 5:34 pm Post subject: |
|
|
Problem is still pending. Could someone help? |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Sun Feb 14, 2010 11:45 pm Post subject: |
|
|
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 |
|
|
cwr Veteran
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Mon Feb 15, 2010 11:42 am Post subject: |
|
|
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Mon Feb 15, 2010 6:14 pm Post subject: |
|
|
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 |
|
|
samo Guru
Joined: 13 Mar 2004 Posts: 489
|
Posted: Thu Feb 25, 2010 5:50 pm Post subject: |
|
|
Please read this topic |
|
Back to top |
|
|
|