[ntp:questions] NTP not syncing

mike cook michael.cook at sfr.fr
Fri Dec 6 09:41:37 UTC 2013


Le 5 déc. 2013 à 19:58, David Woolley a écrit :

> On 05/12/13 14:24, mike cook wrote:
>>> 
>>> 
>>> The problem for ntp is that ntp takes a long time to recover from a bad
>>> drift value.
>>> 
>> 
>> This seems to have been an issue since I started using ntp, more than 10 years ago. I am surprised that it is not fixed.
> 
> If you know the drift file is unreliable, you should delete it.  ntpd will then perform a frequency calibration before entering the main loop.  Otherwise it starts on the basis that the drift value is good and it is seeing measurement errors.

  This is what has been recommended for ages but it doesn't completely fix the issue. It still takes a long time to settle. Here are the results of a test I did using the same system and ntp config as in my previous reply with the unrepresentative drift file data.


root at raspberrypi:/home/mike# date;ntpq -pn |grep \*
Thu Dec  5 23:27:43 CET 2013
*145.238.203.14  .TS-3.           1 u   24   64  377   12.959   -0.193   0.219
root at raspberrypi:/home/mike# cat /var/lib/ntp/ntp.drift
-36.191

  As you can see , low us offset with the same ballpark drift as the previous test.

 root at raspberrypi:/home/mike# /etc/init.d/ntp stop
Stopping NTP server: ntpd.
root at raspberrypi:/home/mike# rm /var/lib/ntp/ntp.drift
root at raspberrypi:/home/mike# date;/etc/init.d/ntp start
Thu Dec  5 23:30:30 CET 2013
Starting NTP server: ntpd.
root at raspberrypi:/home/mike# ntpq -c rv
associd=0 status=0614 leap_none, sync_ntp, 1 event, freq_mode,
version="ntpd 4.2.7p319 at 1.2483 Tue May 28 11:26:22 UTC 2013 (2)",
processor="armv6l", system="Linux/3.2.27-pps", leap=00, stratum=2,
precision=-19, rootdelay=14.359, rootdisp=203.599, refid=145.238.203.14,
reftime=d64b7d18.e970d79a  Thu, Dec  5 2013 23:30:48.911,
clock=d64b7d1a.3b9c15ed  Thu, Dec  5 2013 23:30:50.232, peer=40375, tc=6,
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=2.798376,                                                                          
clk_jitter=4.586, clk_wander=0.000
root at raspberrypi:/home/mike# while true; do date; ntpq -pn |grep \*;ntpq -c rv |grep frequency; ls -l /var/lib/ntp/ntp.drift;cat /var/lib/ntp/ntp.drift; sleep 60; done
Thu Dec  5 23:31:25 CET 2013
*145.238.203.14  .TS-3.           1 u   37   64    1   14.359    3.940   2.798
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=2.798376,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Thu Dec  5 23:32:25 CET 2013
*145.238.203.14  .TS-3.           1 u   41   64    3   14.377    3.253   2.007
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=2.007095,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Thu Dec  5 23:33:26 CET 2013
*145.238.203.14  .TS-3.           1 u   36   64    7   14.306    0.784   1.818
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=1.817799,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Thu Dec  5 23:34:26 CET 2013
*145.238.203.14  .TS-3.           1 u   30   64   17   14.373   -1.636   3.908
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=3.907557,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Thu Dec  5 23:35:26 CET 2013
*145.238.203.14  .TS-3.           1 u   24   64   37   14.405   -4.091   6.132
mintc=3, offset=-5.357144, frequency=0.000, sys_jitter=6.132177,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Thu Dec  5 23:36:27 CET 2013
*145.238.203.14  .TS-3.           1 u   18   64   77   12.958   -7.275   8.750
mintc=3, offset=-7.275249, frequency=-22.113, sys_jitter=8.750094,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory

So under 5 minutes after the start we have a first estimation of the drift. It is not that bad, being  only 10ppm from normal.

The drift file is not updated until an hour after startup, as before. This is a shame as this better approximation would help if there was a restart during this time.

Fri Dec  6 00:28:48 CET 2013
*145.238.203.14  .TS-3.           1 u   45   64  377   14.237   -1.681   0.320
mintc=3, offset=-1.681362, frequency=-33.536, sys_jitter=0.320081,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Fri Dec  6 00:29:48 CET 2013
*145.238.203.14  .TS-3.           1 u   37   64  377   14.237   -1.681   0.297
mintc=3, offset=-1.681362, frequency=-33.536, sys_jitter=0.296960,
ls: cannot access /var/lib/ntp/ntp.drift: No such file or directory
cat: /var/lib/ntp/ntp.drift: No such file or directory
Fri Dec  6 00:30:49 CET 2013
*145.238.203.14  .TS-3.           1 u   31   64  377   14.237   -1.681   0.254
mintc=3, offset=-1.681362, frequency=-33.536, sys_jitter=0.253768,
-rw-r--r-- 1 root root 8 Dec  6 00:30 /var/lib/ntp/ntp.drift
-33.536

We don't get back to the normal stable state until around 2hrs after restart.

Fri Dec  6 01:31:13 CET 2013
*145.238.203.14  .TS-3.           1 u   44   64  377   14.165    0.078   0.149
mintc=3, offset=0.078378, frequency=-36.529, sys_jitter=0.148868,
-rw-r--r-- 1 root root 8 Dec  6 01:30 /var/lib/ntp/ntp.drift
-36.529



> 
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions


More information about the questions mailing list