LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2011, 04:47 PM   #1
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Rep: Reputation: 0
NTP issues and system time drift


Rather than repost everything:
http://ubuntuforums.org/showthread.php?t=1793516

I updated the thread there today.

It seems as though, from what I have read, that there may be another app/tool that is tinking with the time other than NTPD?

from yesterday checking HWclock against system time after doing a ntpdate sync and starting NTPD again it would slowly creep ahead, but never more than 5 seconds
Code:
Thu 01 Dec 2011 01:22:22 PM PST -0.665057 seconds
Thu Dec 1 13:22:23 PST 2011
and then it would appear to sync and bring in back inline.
Code:
Thu 01 Dec 2011 01:28:26 PM PST -0.529493 seconds
Thu Dec 1 13:28:26 PST 2011
Then this morning I checked HWclock against system time and it ~5 min off. Now in the afternoon its 8 minutes off:
Code:
Fri 02 Dec 2011 08:49:05 AM PST -0.417030 seconds
Fri Dec 2 08:52:24 PST 2011

Any help is appreciated.
 
Old 12-03-2011, 03:22 PM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
You might want to check the battery if it's an older box (the hardware clock runs from the battery and if the battery is low, dead or whatever...). This will be a problem if the system is turned off between sessions.

Another thing you might want to look into is the hwclock utility, the section on --adjust and the section The Adjust Function about line 280-ish in the manual page. You can "walk" the adjustment (carefully! a little at a time) to bring the hardware clock in sync with the system clock.

Additionally, look at the drift file in /etc/ntp. There should be a floating-point number there; if /etc/ntp/drift does not exist, do something like this
Code:
echo 0.0 > /etc/ntp/drift
Might help.

Of course, if your NTP stuff isn't in /etc/ntp, adjust the above to where it actually lives.

Hope this helps some.

Last edited by tronayne; 12-03-2011 at 03:23 PM.
 
Old 12-04-2011, 11:23 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
From your other post it appears that you are polling the desired timer server. I never saw it synched i.e. the * before the server name in the output of the ntpq -p command. If you zero out the drift file it will take 900s or so for ntp to perform its inital calibration.

The hardware clock is not very accurate and I believe that if the system clock is synched via ntp it will be updated every 11 minutes.
 
Old 12-04-2011, 02:27 PM   #4
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Doesn't the hwckock cmd tell me the hardware time? That is actually acurate.
 
Old 12-04-2011, 04:14 PM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by Cyked View Post
Doesn't the hwckock cmd tell me the hardware time? That is actually acurate.
Yes, it does -- which indicates that the system clock isn't getting synchronized by NTP.

When you're in sync, running ntpq -p will show something like this:
Code:
/usr/sbin/ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l  12h   64    0    0.000    0.000   0.000
+247.conarusp.ne 216.218.254.202  2 u  870 1024  377  1324.69   -4.405  68.871
*ntp.cox.net     .GPS.            1 u  756 1024  377  1493.03   15.182  16.085
+rapture.knovide 64.90.182.55     2 u  317 1024  377  1703.45  -73.680  53.170
The asterisk indicates that the clock is synchronized to ntp.cox.net.

So, take a look at your /etc/ntp.conf and perhaps try this:
Code:
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
#server  pool.ntp.org
server  0.us.pool.ntp.org
server  1.us.pool.ntp.org
server  2.us.pool.ntp.org
The local clock set to stratum 10 is a fall-back for when the network goes away (NTP will initially synchronize LOCAL, then to an external server, and more or less syncs to itself for a while when the network goes away).

The three pool servers allow NTP to synchronize to the best electrically close external server; I use three US pool servers -- if you're not in the US, you can choose from pool servers in your area or simply
Code:
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
Bottom line: if you run ntpq -p and do not see the display similar to the above, your system clock is not synchronized and it will wander all over the place.

Hope this helps some.

Last edited by tronayne; 12-04-2011 at 04:17 PM.
 
Old 12-04-2011, 04:50 PM   #6
timetraveler
Member
 
Registered: Apr 2010
Posts: 243
Blog Entries: 2

Rep: Reputation: 31
Ditch NTP altogether and use clockspeed?
 
Old 12-04-2011, 05:38 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
The only purpose of the hardware clock is to provide a time source for the system clock when the computer is powered on. The hardware clock and system clock are independent of each other. The hardware drift correction is stored in /etc/adjtime and the system clock correction is stored in the ntp driftfile.

http://www.ntp.org/ntpfaq/NTP-s-sw-clocks-quality.htm

Have you made any recent changes to your system?
 
Old 12-04-2011, 07:19 PM   #8
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
To be clear. I don't expect my system to sync to the hw clock. If I reboot system syncs to the hw clock correctly. I hardly reboot so drift happens when on. I reboot maybe once q month. If that.
[Quite]
Have you made any recent changes to your system?[/QUOTE]

This has been going on for months


Ill try some of things suggested above next time I remote in. Thanks for the tips so far. Ill repoet back.
 
Old 12-05-2011, 11:23 AM   #9
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Code:
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time-a.nist.gov .ACTS.           1 u    -   64    1  123.235  -171828  18.926
 mail.freerip.co 67.18.187.111    3 u    3   64    1   34.384  -171826   0.001
 ponderosa.piney 64.90.182.55     2 u    2   64    1  102.507  -171827   0.001
 ntp1.Rescomp.Be 169.229.128.214  3 u    2   64    1   15.667  -171827   0.001
 clock.trit.net  192.12.19.20     2 u    1   64    1   36.483  -171827   0.001
I added the "fudge 127.127.1.0 stratum 10" to my ntp.conf file.

What SHOULD the drift file have? x.xxx, but previously my drift file was something like -10.197. Should it be a negative number?


After making the changes (i reverted the drive file to -10.197 it was a few days ago, and adding back the ntp pool servers to the conf file), stopping and starting NTP...

My system time is synced and OK. BOTH these times are very very very close to my Win7 machine. I'll see what happens the remainder of the day and check, and check times again in the AM.

Code:
 sudo hwclock;date
Mon 05 Dec 2011 09:22:12 AM PST  -0.076789 seconds
Mon Dec  5 09:22:12 PST 2011
 
Old 12-05-2011, 12:30 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
Wait until the value of reach becomes 377 and post the output of ntpq -p again. Hopefully your system will show that it is synced to a time server.
Yes, it can be a negative number. Depends if your system clock runs fast or slow.
 
Old 12-05-2011, 12:34 PM   #11
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Code:
 hwclock;date
Mon 05 Dec 2011 10:34:14 AM PST  -0.268159 seconds
Mon Dec  5 10:34:14 PST 2011
dpaul01@tux:~$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time-a.nist.gov .ACTS.           1 u   63   64  377  100.387  -7508.1 1476.41
 ibird.bahosting 208.53.158.34    3 u   15   64  377   97.558  -7754.1 1485.46
 173.244.211.10. 131.107.13.100   2 u   20   64  377   36.406  -7728.8 1478.34
 cheezum.mattnor 129.7.1.66       2 u    4   64  377   52.893  -7817.9 1498.77
 name1.glorb.com 130.207.244.240  2 u   38   64  377   81.931  -7645.4 1494.30
 
Old 12-05-2011, 01:10 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
The output does not show your computer locked to a time server i.e. (*).
You restarted ntp but output does not show your local (fudge) clock.
Your offset has decreased from ~171 seconds to ~7 so something is happening...

Just to verify this is not a virtual machine?
 
Old 12-05-2011, 01:12 PM   #13
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Correct, its not a VM.
 
Old 12-05-2011, 01:30 PM   #14
Cyked
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
So why is it not locking to a server?
 
Old 12-05-2011, 03:09 PM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,734

Rep: Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920Reputation: 5920
What type of computer desktop or laptop?
Can its clock speed vary? If so try disabling it.
And you could try disabling apic.

http://www.math.ucla.edu/~jimc/docum...wont-sync.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP Issues zaeem Linux - Server 6 05-17-2011 08:51 AM
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack niels.horn Slackware 16 05-07-2009 07:35 PM
NTP Issues piercey Linux - Server 2 01-13-2009 11:11 AM
NTP issues RHEL5 adamjohnson01 Red Hat 4 06-06-2008 07:23 AM
NTP issues? Blinker_Fluid Solaris / OpenSolaris 8 05-30-2008 01:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration