Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-16 Thread Miroslav Lichvar
On Wed, Aug 16, 2017 at 01:52:44PM +0100, Etaoin Shrdlu wrote:
> Hi all, 
> 
> I've been battling for some time with getting ntpd to set the date/time
> from gpsd's shared memory locations. My GPS device is on the network
> and sends GPS messages every minute over UDP. This is picked up by gpsd
> and it appears I get a good fix with all the required data. It also
> looks as if the shared memory locations are being set up correctly. But
> whatever I do, ntpd time source "reach" stubbornly remains at zero,
> even when running ntpd as root. I would be most grateful if someone
> could cast their eyes on the configurations and log output below, and
> let me know if you can see were it's going wrong! 

There is a ntpshmmon program included with gpsd, which should show you
if gpsd is actually writing to the SHM segments and whether it's a
problem on the gpsd or ntpd side. However, I'm not sure if this is
supposed to work with GPS over network.

-- 
Miroslav Lichvar
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


[ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-16 Thread Etaoin Shrdlu
Hi all, 

I've been battling for some time with getting ntpd to set the date/time
from gpsd's shared memory locations. My GPS device is on the network
and sends GPS messages every minute over UDP. This is picked up by gpsd
and it appears I get a good fix with all the required data. It also
looks as if the shared memory locations are being set up correctly. But
whatever I do, ntpd time source "reach" stubbornly remains at zero,
even when running ntpd as root. I would be most grateful if someone
could cast their eyes on the configurations and log output below, and
let me know if you can see were it's going wrong! 

P.S. This has been cross-posted from gpsd-us...@nongnu.org, where I
failed to get any response to my query. 


# syslog gpsd startup: 

Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: launching (Version 3.11)
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: listening on port gpsd
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(0,0,0) succeeded, 
segment 0
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(32769,0,0) succeeded, 
segment 1
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(65538,0,0) succeeded, 
segment 2
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(98307,0,0) succeeded, 
segment 3
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: successfully connected to the 
DBUS system bus
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shmat() succeeded, segment 131076
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shared-segment creation 
succeeded,
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: stashing device 
udp://192.168.13.100:10110 at slot 0
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: opening UDP feed at 
192.168.13.100, port 10110.
Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: UDP device open error can't 
connect to host/port pair.
Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: initial GPS device 
udp://192.168.13.100:10110 open failed
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with effective group ID 
20
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with effective user ID 
110
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: startup at 
2017-08-06T19:28:16.000Z (1502047696)

# syslog ntpd startup:

Aug  6 19:28:24 computer ntpd[609]: ntpd 4.2.6p5@1.2349-o Mon Jul 25 22:35:28 
UTC 2016 (1)
Aug  6 19:28:24 computer ntp[582]: Starting NTP server: ntpd.
Aug  6 19:28:24 computer ntpd[652]: proto: precision = 0.781 usec
Aug  6 19:28:24 computer ntpd[652]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 
123
Aug  6 19:28:24 computer systemd[1]: Started LSB: Start NTP daemon.
Aug  6 19:28:25 computer ntpd[652]: Listen and drop on 1 v6wildcard :: UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 2 lo 127.0.0.1 UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 3 eth0 192.168.13.100 
UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 4 lo ::1 UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 5 eth0 
fe80::6a89:f1d3:7ec0:510 UDP 123
Aug  6 19:28:25 computer ntpd[652]: peers refreshed
Aug  6 19:28:25 computer ntpd[652]: Listening on routing socket on fd #22 for 
interface updates

# syslog gpsd sample: 

Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGGA,185748.0,1234.567890,N,00012.345678,E,1,10,0.9,13.6,M,47.0,M,,*6B
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGGA sentence timestamped 
185748.00.
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGGA starts a reporting cycle.
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPRMC,185748.0,A,1234.567890,N,00012.345678,E,0.0,,060817,0.0,E,A*2B
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPRMC sentence timestamped 
185748.00.
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPRMC ends a reporting cycle.
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPVTG,,T,0.0,M,0.0,N,0.0,K,A*0D
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSA,A,2,01,03,06,09,11,17,19,22,23,31,,,1.2,0.9,0.8*31
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGSA sets mode 2
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,1,13,01,31,136,41,03,67,068,35,06,32,303,31,09,34,202,41*78
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (1 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,2,13,11,09,153,39,17,40,243,40,19,42,272,30,22,42,082,40*78
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (2 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,3,13,23,61,174,46,31,19,047,36,12,04,329,,14,00,039,*76
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (3 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: $GPGSV,4,4,13,25,01,001,*4C


# /etc/default/gpsd

START_DAEMON="true"
USBAUTO="false"
DEVICES="udp://192.168.13.100:10110"
GPSD_OPTIONS="-n -D5"


# ntpd.conf: 

GPS Serial data reference (NTP0)
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 time1 0.0 refid GPS

GPS PPS reference (NTP1)
server