six demon bag

Wind, fire, all that kind of thing!

2015-02-22

NTP "Leap not in sync"

Today I had a rather curious problem on my fileserver. I noticed that its system time was behind the clock, but when I tried to manually synchronize it with my timeserver, ntpdate failed with the error message "Leap not in sync".


root@argon:~ # ntpdate -d 192.168.42.23
22 Feb 18:52:24 ntpdate[3329]: ntpdate 4.2.6p5@1.2349-o Sat Feb  7 11:39:18 UTC 2015 (1)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
192.168.42.23: Server dropped: Leap not in sync
server 192.168.42.23, port 123
stratum 3, precision -22, leap 11, trust 000
refid [192.168.42.23], delay 0.02602, dispersion 0.00224
transmitted 4, in filter 4
reference time:    d89495bf.230f70b6  Sun, Feb 22 2015 18:51:59.136
originate timestamp: d89495ea.0ee74edf  Sun, Feb 22 2015 18:52:42.058
transmit timestamp:  d89495de.4abca026  Sun, Feb 22 2015 18:52:30.291
filter delay:  0.02602  0.02635  0.02628  0.02625 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 11.76273 11.76386 11.76494 11.76586
         0.000000 0.000000 0.000000 0.000000
delay 0.02602, dispersion 0.00224
offset 11.762738

22 Feb 18:52:30 ntpdate[3329]: no server suitable for synchronization found

The stratum value looked okay, but leap 11 seems to indicate that ntpdate thinks that the timeserver's time is out of sync.

ntpq output showed that the fileserver hadn't yet run the initial synchronization:

root@argon:~ # ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.42.23   .INIT.          16 u    -   64    0    0.000    0.000   0.000

NTP on the timeserver itself seemed fine, though:

root@oxygen:~ # ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+94.126.19.139   192.33.96.102    2 u   42   64  177   11.748  791.110 468.439
+81.94.123.17    85.158.25.74     2 u   38   64  377   12.501  796.061 468.589
+195.186.4.101   195.186.150.242  2 u   31   64  377   11.121  807.080 475.074
*192.33.96.102   .PPS.            1 u    4   64  377   11.966  849.457 471.586
 192.168.42.255  .BCST.          16 u    -   64    0    0.000    0.000   0.000

Both servers are in the same network, and the ntpd is listening on the correct port:

root@oxygen:~ # netstat -nulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
...
udp        0      0 192.168.42.23:123       0.0.0.0:*                           25233/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           25233/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           25233/ntpd

No packet filter between ntpdate and ntpd either, so apparently it wasn't a network issue:

root@oxygen:~ # iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

As it turned out I had to force the initial synchronization by running ntpdate with its "shut up and set the f***ing time" parameter (-b) to make things work:

root@argon:~ # ntpdate -b 192.168.42.23
22 Feb 20:26:41 ntpdate[3663]: step time server 192.168.42.23 offset 5.404747 sec
root@argon:~ # ntpdate -d 192.168.42.23
22 Feb 20:26:50 ntpdate[3665]: ntpdate 4.2.6p5@1.2349-o Sat Feb  7 11:39:18 UTC 2015 (1)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
transmit(192.168.42.23)
receive(192.168.42.23)
server 192.168.42.23, port 123
stratum 3, precision -22, leap 00, trust 000
refid [192.168.42.23], delay 0.02605, dispersion 0.00113
transmitted 4, in filter 4
reference time:    d894abdd.b5f246df  Sun, Feb 22 2015 20:26:21.710
originate timestamp: d894ac00.55c60555  Sun, Feb 22 2015 20:26:56.335
transmit timestamp:  d894ac00.535ecb92  Sun, Feb 22 2015 20:26:56.325
filter delay:  0.02623  0.02605  0.02611  0.02628 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 0.005370 0.006571 0.007679 0.008970
         0.000000 0.000000 0.000000 0.000000
delay 0.02605, dispersion 0.00113
offset 0.006571

22 Feb 20:26:56 ntpdate[3665]: adjust time server 192.168.42.23 offset 0.006571 sec
...
root@argon:~ # ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.42.23   91.234.160.19    3 u    7   64    1    0.298   35.256   3.630

Posted 21:40 [permalink]