You are not logged in.

#1 2011-09-18 10:50:18

roygbiv
Member
Registered: 2011-05-18
Posts: 204

ntpd hostname not found

I'm using ntpd to sync my computer clock, but my time is always skewed 2 hrs. forward after booting. After some time, it is set correctly. I've followed the wiki on setting up ntpd and finding a near pool server using http://www.pool.ntp.org. I noticed some errors in /var/log/errors.log:

Sep 18 14:33:30 localhost ntpd_intres[1040]: host name not found: 0.no.pool.ntp.org
Sep 18 14:33:30 localhost ntpd_intres[1040]: host name not found: 1.no.pool.ntp.org
Sep 18 14:33:30 localhost ntpd_intres[1040]: host name not found: 2.no.pool.ntp.org
Sep 18 14:33:30 localhost ntpd_intres[1040]: host name not found: 3.no.pool.ntp.org

I guess this is happening because before wicd gives me a connection (ntpd daemon loads before wicd daemon). Does ntpd need internet access all the time while running, in order to set/store the clock? How do I retain the clock set by ntpd when i have no internet connection? I may have misunderstood something here.

My /etc/ntp.conf:

# NOTES:
#  - you should only have to update the server line below
#  - if you start getting lines like 'restrict' and 'fudge'
#    and you didnt add them, AND you run dhcpcd on your
#    network interfaces, be sure to add '-Y -N' to the
#    dhcpcd_ethX variables in /etc/conf.d/net

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

server 0.no.pool.ntp.org
server 1.no.pool.ntp.org
server 2.no.pool.ntp.org
server 3.no.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
##

#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.

# A default deny all (including localhost) policy
# To use this define restrictions for all servers and clients
#restrict default ignore
#restrict -6 default ignore

# A more open policy, allow access but deny changing the configuration
restrict default nomodify nopeer
#restrict -6 default nomodify nopeer

# Allow localhost
restrict 127.0.0.1
#restrict -6 ::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


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

Last edited by roygbiv (2011-09-18 10:57:38)

Offline

#2 2011-09-18 12:03:24

7etc/
Member
Registered: 2010-05-08
Posts: 47

Re: ntpd hostname not found

Hello:
In your /etc/ntp.conf, add "iburst" (without quotes) at the end of every server. From the wiki page: " The iburst option is recommended, and sends a burst of packets if it cannot obtain a connection with the first attempt. The burst option always sends a burst of packets, even on the first attempt...

Offline

#3 2011-09-18 13:55:41

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: ntpd hostname not found

Done, but still the same behaviour - only slightest less time for the clock to adjust correctly after boot.

Last edited by roygbiv (2011-09-18 13:55:56)

Offline

#4 2011-09-18 13:56:29

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: ntpd hostname not found

like this:

#server		ntp.example.tld		iburst

server 		0.us.pool.ntp.org	iburst
server 		1.us.pool.ntp.org	iburst
server 		2.us.pool.ntp.org	iburst
server 		3.us.pool.ntp.org	iburst

I laugh, yet the joke is on me

Offline

#5 2011-09-18 14:09:18

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: ntpd hostname not found

Yep, i have done it

# NOTES:
#  - you should only have to update the server line below
#  - if you start getting lines like 'restrict' and 'fudge'
#    and you didnt add them, AND you run dhcpcd on your
#    network interfaces, be sure to add '-Y -N' to the
#    dhcpcd_ethX variables in /etc/conf.d/net

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

server 0.no.pool.ntp.org iburst
server 1.no.pool.ntp.org iburst
server 2.no.pool.ntp.org iburst
server 3.no.pool.ntp.org iburst

##
# 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
##

#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.

# A default deny all (including localhost) policy
# To use this define restrictions for all servers and clients
#restrict default ignore
#restrict -6 default ignore

# A more open policy, allow access but deny changing the configuration
restrict default nomodify nopeer
#restrict -6 default nomodify nopeer

# Allow localhost
restrict 127.0.0.1
#restrict -6 ::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


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

Still the same behaviour. But is there some way to store the adjusted clock time when not having internet access, or is this done automagically?

Last edited by roygbiv (2011-09-18 14:13:57)

Offline

#6 2011-09-18 14:28:49

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: ntpd hostname not found

Is it exactly two hours off?

If it is off by exactly two hours, have you set your rc.conf HARDWARECLOCK to UTC?

Last edited by the sad clown (2011-09-18 14:31:48)


I laugh, yet the joke is on me

Offline

#7 2011-09-18 14:33:46

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: ntpd hostname not found

the sad clown wrote:

Is it exactly two hours off?

If it is off by exactly two hours, have you set your rc.conf HARDWARECLOCK to UTC?

Yes it is two hours off, and yes HARDWARECLOCK is set to UTC.

Offline

#8 2011-09-18 15:35:05

DerFlob
Member
From: Munich, Germany
Registered: 2011-09-18
Posts: 21

Re: ntpd hostname not found

roygbiv wrote:
the sad clown wrote:

Is it exactly two hours off?

If it is off by exactly two hours, have you set your rc.conf HARDWARECLOCK to UTC?

Yes it is two hours off, and yes HARDWARECLOCK is set to UTC.

Do you have a dualboot system with Windows? By default Windows sets the hardware clock to localtime and not UTC.
See https://wiki.archlinux.org/index.php/Rc … calization -> Hardwareclock

Offline

#9 2011-09-18 15:50:24

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: ntpd hostname not found

Could you post the output of hwclock --debug  (You will have to run it with root permissions)?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#10 2011-09-18 16:39:53

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: ntpd hostname not found

Here we go:

# hwclock --debug
hwclock from util-linux 2.20
Using /dev interface to clock.
Last drift adjustment done at 1312847247 seconds after 1969
Last calibration done at 1312241327 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2011/09/18 18:39:03
Hw clock time : 2011/09/18 18:39:03 = 1316371143 seconds since 1969
Sun 18 Sep 2011 08:39:03 PM CEST  -0.860120 seconds

@DerFlob
Actually I have Windoes 7 on my 1st partition. Changed HARWARECLOCK=localtime.

Last edited by roygbiv (2011-09-18 16:50:48)

Offline

#11 2011-09-18 17:25:38

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: ntpd hostname not found

For starters, hwclock tells us that your system thinks that it is set to UTC.  But... your UTC reference is off by one hour

ewaller@odin:~ 1009 %date -u             
Sun Sep 18 17:18:03 UTC 2011
ewaller@odin:~ 1010 %

Yours is an hour ahead of that. 

Actually I have Windoes 7 on my 1st partition. Changed HARWARECLOCK=localtime.

I really don't recommend that, but it is your system.  I prefer to tell Windows to use UTC.  It solves a lot of problems.

My suggestion:  Set HARDWARECLOCK back to UTC
Ensure that your system has the correct date, time and timezone

ewaller@odin:~ 1003 %date
Sun Sep 18 10:24:04 PDT 2011
ewaller@odin:~ 1004 %

If not, set it.

Then perform (as root) hyclock --systohc


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#12 2011-09-18 18:09:57

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: ntpd hostname not found

ewaller wrote:

For starters, hwclock tells us that your system thinks that it is set to UTC.  But... your UTC reference is off by one hour

ewaller@odin:~ 1009 %date -u             
Sun Sep 18 17:18:03 UTC 2011
ewaller@odin:~ 1010 %

Yours is an hour ahead of that. 

Actually I have Windoes 7 on my 1st partition. Changed HARWARECLOCK=localtime.

I really don't recommend that, but it is your system.  I prefer to tell Windows to use UTC.  It solves a lot of problems.

My suggestion:  Set HARDWARECLOCK back to UTC
Ensure that your system has the correct date, time and timezone

ewaller@odin:~ 1003 %date
Sun Sep 18 10:24:04 PDT 2011
ewaller@odin:~ 1004 %

If not, set it.

Then perform (as root) hyclock --systohc

Ok, chose to follow your advice. I've set Arch and Windows 7 to use UTC (Win7 using the regedit method. Also I set hwclock from system clock:

# hwclock --systohc

Now it seems they both are the same, when issuing date and hwclock commands (only hwclock is not 24-hour format). As I have understood, using ntpd should replace hwclock daemon, so no need to use it right?

Offline

#13 2011-09-18 18:29:30

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: ntpd hostname not found

Well, I use both.  When the system starts, it gets the best time available from the hardware clock at boot.  That time reference is used in all of the logs, and to determine whether things have already happened in the future (generally a bad thing -- the kernel realizes it is not using the same time reference as it had in the past)

Then, when I achieve connectivity with the internet, ntpd starts and synchronizes my system to a reference to a system that has a higher stratum than my own.  It is my understanding that this is done by slowly by implementing a servo that catches the real time, and then tracks it.  In this way, there are no discontinuities in the system time. (No jumps forward, or, [even worse] backward)

only hwclock is not 24-hour format

I am afraid I don't understand.  hwclock definitively uses 24 hour format here hmm


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB