NTPsec flags my GPS as a falseticker

Nick Burkitt nick.burkitt at nanotok.com
Thu Mar 19 06:40:47 UTC 2020


Hi.

I'm trying to get gpsd (3.20) and ntpd (NTPsec 1.1.8+) to keep reliable 
time when no network is available. This is a common use case for one of 
my customers. Outdoors, full sky view, no network. Time accuracy (< 1 
ms) is critical, and well within the capabilities of the hardware.

But - when there are no network severs available, ntpd marks my GPS as a 
falseticker. That leaves zero tickers, so PPS is x-ed as well.

      remote           refid      st t when poll reach   delay   offset   
jitter
xSHM(2)          .PPS.            0 l    2    8  377      0ns -13.57us 
17.302us
  0.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  
1.907us
  1.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  
1.907us
  2.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  
1.907us
  3.us.pool.ntp.o .DNS.           16 u    -    8    0      0ns      0ns  
1.907us
xSHM(0)          .GPS.            0 l    6    8  377      0ns 4.7432ms 
2.3207ms
  pool.ntp.org    .POOL.          16 p    -    8    0      0ns      0ns  
1.907us
ntpd ntpsec-1.1.8+ 2020-03-04T20:55:58Z        Updated: 
2020-03-19T01:28:58 (4)
  lstint avgint rstr r m v  count rport remote address
       0  0.403    0 . 6 2   1891 45046 localhost

I've tweaked the value of time1 on my PPS refclock command, and 
occasionally ntpd will take the GPS off the blacklist, but it never 
lasts, although the PPS offset seems to stay very small.
It's been suggested that ntpd might not be the best tool for this 
scenario, but I'd prefer to salvage my development investment if 
possible.

Hardware:
Custom PCB with u-blox NEO-8MT, connected via USB to a Xilinx Zynq 
(Artix FPGA + ARM Cortex A9). A kernel-mode driver handles PPS 
interrupts from the u-blox, using the standard kernel PPSAPI.

Software:
Linux kernel 4.19.101
Ubuntu 18.04 LTS
gpsd 3.20
NTPsec 1.1.8+
Custom kernel PPS driver

Configuration:
ntpd.conf:
minsane 1
refclock shm unit 2 refid PPS minpoll 3 maxpoll 3 prefer flag4 1
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
refclock shm unit 0 refid GPS minpoll 3 maxpoll 4 time1 0.080 flag4 1
restrict default kod limited nomodify nopeer noquery
restrict -6 default kod limited nomodify nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
logfile /var/log/ntpd.log
logconfig =syncall +clockall +peerall +sysall

Command lines:
root at MPM-4006:~# ps -ef|egrep '(ntp|gps)'|grep -v grep
nobody    9609     1  0 01:15 ?        00:01:05 /usr/local/sbin/gpsd -n 
/dev/core100/gnss /dev/pps0
ntp      19607     1  0 02:39 ?        00:00:22 /usr/local/sbin/ntpd -D 
10 -g -N -u ntp:ntp

PPS is working:
root at MPM-4006:/etc/ntp.d# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1584584485.000037822, sequence: 3939 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584486.000036522, sequence: 3940 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584487.000044277, sequence: 3941 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584488.000039254, sequence: 3942 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584489.000037024, sequence: 3943 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584490.000036379, sequence: 3944 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584491.000037345, sequence: 3945 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584492.000037605, sequence: 3946 - clear  
0.000000000, sequence: 0
source 0 - assert 1584584493.000037058, sequence: 3947 - clear  
0.000000000, sequence: 0

A few hours of ntpd.log:
root at MPM-4006:~# tail -40000 /var/log/ntpd.log | grep -a DNS|wc -l
39915

root at MPM-4006:~# tail -40000 /var/log/ntpd.log | grep -a -v DNS
2020-03-19T02:39:10 ntpd[12274]: ERR: ntpd exiting on signal 15 
(Terminated)
2020-03-19T02:39:10 ntpd[12274]: PROTO: SHM(2) 9612 82 demobilize assoc 
43954
2020-03-19T02:39:10 ntpd[12274]: PROTO: 127.127.28.2 unlink local addr 
127.0.0.1 -> <null>
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 
43955
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 
43956
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 
43957
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8012 82 demobilize assoc 
43958
2020-03-19T02:39:10 ntpd[12274]: PROTO: SHM(0) 9412 82 demobilize assoc 
43959
2020-03-19T02:39:10 ntpd[12274]: PROTO: 127.127.28.0 unlink local addr 
127.0.0.1 -> <null>
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 8812 82 demobilize assoc 
43960
2020-03-19T02:39:10 ntpd[12274]: PROTO: 0.0.0.0 001d 0d kern kernel time 
sync disabled
2020-03-19T02:39:11 ntpd[19607]: INIT: Using SO_TIMESTAMPNS
2020-03-19T02:39:11 ntpd[19607]: IO: Listen and drop on 0 v6wildcard 
[::]:123
2020-03-19T02:39:11 ntpd[19607]: IO: Listen and drop on 1 v4wildcard 
0.0.0.0:123
2020-03-19T02:39:11 ntpd[19607]: IO: Listen normally on 2 lo 
127.0.0.1:123
2020-03-19T02:39:11 ntpd[19607]: IO: Listen normally on 3 lo [::1]:123
2020-03-19T02:39:11 ntpd[19607]: IO: Listening on routing socket on fd 
#20 for interface updates
2020-03-19T02:39:11 ntpd[19607]: PROTO: 127.127.28.2 8011 81 mobilize 
assoc 21309
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 
21310
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 
21311
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 
21312
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8011 81 mobilize assoc 
21313
2020-03-19T02:39:11 ntpd[19607]: PROTO: 127.127.28.0 8011 81 mobilize 
assoc 21314
2020-03-19T02:39:11 ntpd[19607]: CONFIG: configpeers: Ignoring duplicate 
'127.127.28.2'
2020-03-19T02:39:11 ntpd[19607]: CONFIG: configpeers: Ignoring duplicate 
'127.127.28.0'
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 8811 81 mobilize assoc 
21315
2020-03-19T02:39:11 ntpd[19607]: SYNC: Found 10 servers, suggest minsane 
at least 3
2020-03-19T02:39:11 ntpd[19607]: INIT: This system has a 32-bit time_t.
2020-03-19T02:39:11 ntpd[19607]: INIT: This ntpd will fail on 
2038-01-19T03:14:07Z.
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c01d 0d kern kernel time 
sync enabled
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c012 02 freq_set kernel 
7.502304 PPM
2020-03-19T02:39:11 ntpd[19607]: PROTO: 0.0.0.0 c016 06 restart
2020-03-19T02:39:11 ntpd[19607]: INIT: OpenSSL 1.1.0g  2 Nov 2017, 
1010007f
2020-03-19T02:39:11 ntpd[19607]: NTSc: Using system default root 
certificates.
2020-03-19T02:39:12 ntpd[19607]: PROTO: SHM(2) 8014 84 reachable
2020-03-19T02:39:12 ntpd[19607]: PROTO: SHM(2) 901a 8a sys_peer
2020-03-19T02:39:12 ntpd[19607]: PROTO: 0.0.0.0 c415 05 clock_sync
2020-03-19T02:39:17 ntpd[19607]: PROTO: SHM(0) 8014 84 reachable
2020-03-19T02:39:17 ntpd[19607]: PROTO: 0.0.0.0 0418 08 no_sys_peer
2020-03-19T02:39:49 ntpd[19607]: PROTO: SHM(2) 912a 8a sys_peer
2020-03-19T02:40:05 ntpd[19607]: PROTO: 0.0.0.0 0428 08 no_sys_peer
2020-03-19T02:40:13 ntpd[19607]: PROTO: SHM(2) 913a 8a sys_peer
2020-03-19T02:40:21 ntpd[19607]: PROTO: 0.0.0.0 0438 08 no_sys_peer
2020-03-19T02:40:32 ntpd[19607]: PROTO: SHM(2) 914a 8a sys_peer
2020-03-19T02:40:37 ntpd[19607]: PROTO: 0.0.0.0 0448 08 no_sys_peer
2020-03-19T02:41:41 ntpd[19607]: PROTO: SHM(2) 915a 8a sys_peer
2020-03-19T02:41:49 ntpd[19607]: PROTO: 0.0.0.0 0458 08 no_sys_peer
2020-03-19T02:41:57 ntpd[19607]: PROTO: SHM(2) 916a 8a sys_peer
2020-03-19T02:42:05 ntpd[19607]: PROTO: 0.0.0.0 0468 08 no_sys_peer
2020-03-19T02:42:13 ntpd[19607]: PROTO: SHM(2) 917a 8a sys_peer
2020-03-19T02:42:21 ntpd[19607]: PROTO: 0.0.0.0 0478 08 no_sys_peer
2020-03-19T02:42:45 ntpd[19607]: PROTO: SHM(2) 918a 8a sys_peer
2020-03-19T02:42:53 ntpd[19607]: PROTO: 0.0.0.0 0488 08 no_sys_peer
2020-03-19T02:43:17 ntpd[19607]: PROTO: SHM(2) 919a 8a sys_peer
2020-03-19T02:43:25 ntpd[19607]: PROTO: 0.0.0.0 0498 08 no_sys_peer
2020-03-19T02:43:57 ntpd[19607]: PROTO: SHM(2) 91aa 8a sys_peer
2020-03-19T02:44:05 ntpd[19607]: PROTO: 0.0.0.0 04a8 08 no_sys_peer
2020-03-19T02:44:13 ntpd[19607]: PROTO: SHM(2) 91ba 8a sys_peer
2020-03-19T02:45:01 ntpd[19607]: PROTO: 0.0.0.0 04b8 08 no_sys_peer
2020-03-19T02:45:25 ntpd[19607]: PROTO: SHM(2) 91ca 8a sys_peer
2020-03-19T02:45:33 ntpd[19607]: PROTO: 0.0.0.0 04c8 08 no_sys_peer
2020-03-19T02:45:57 ntpd[19607]: PROTO: SHM(2) 91da 8a sys_peer
2020-03-19T02:46:13 ntpd[19607]: PROTO: 0.0.0.0 04d8 08 no_sys_peer
2020-03-19T02:47:17 ntpd[19607]: PROTO: SHM(2) 91ea 8a sys_peer
2020-03-19T02:47:25 ntpd[19607]: PROTO: 0.0.0.0 04e8 08 no_sys_peer
2020-03-19T02:47:41 ntpd[19607]: PROTO: SHM(2) 91fa 8a sys_peer
2020-03-19T02:47:57 ntpd[19607]: PROTO: 0.0.0.0 04f8 08 no_sys_peer
2020-03-19T04:47:44 ntpd[19607]: PROTO: SHM(2) 911b 8b clock_event 
clk_no_reply
2020-03-19T04:47:49 ntpd[19607]: PROTO: SHM(0) 911b 8b clock_event 
clk_no_reply
2020-03-19T04:48:40 ntpd[19607]: PROTO: SHM(2) 8113 83 unreachable
2020-03-19T04:48:40 ntpd[19607]: PROTO: SHM(2) 8114 84 reachable
2020-03-19T05:21:25 ntpd[19607]: PROTO: SHM(2) 911a 8a sys_peer
2020-03-19T05:27:25 ntpd[19607]: PROTO: SHM(2) 912a 8a sys_peer
2020-03-19T05:28:29 ntpd[19607]: PROTO: SHM(2) 913a 8a sys_peer
2020-03-19T05:29:25 ntpd[19607]: PROTO: SHM(2) 914a 8a sys_peer
2020-03-19T05:33:41 ntpd[19607]: PROTO: SHM(2) 915a 8a sys_peer
2020-03-19T05:35:09 ntpd[19607]: PROTO: SHM(2) 916a 8a sys_peer
2020-03-19T05:39:41 ntpd[19607]: PROTO: SHM(2) 917a 8a sys_peer
2020-03-19T05:53:01 ntpd[19607]: PROTO: SHM(2) 918a 8a sys_peer
2020-03-19T05:59:57 ntpd[19607]: PROTO: SHM(2) 919a 8a sys_peer
2020-03-19T06:00:53 ntpd[19607]: PROTO: SHM(2) 91aa 8a sys_peer
2020-03-19T06:20:37 ntpd[19607]: PROTO: SHM(2) 91ba 8a sys_peer
2020-03-19T06:30:37 ntpd[19607]: PROTO: SHM(2) 91ca 8a sys_peer
2020-03-19T06:31:09 ntpd[19607]: PROTO: SHM(2) 91da 8a sys_peer

Thanks,

-Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/users/attachments/20200319/ca5d52e7/attachment.htm>


More information about the users mailing list