1

I am attempting to use a USB GPS without PPS dongle as the sole time source on Ubuntu 18.04. GPSD appears to be working correctly since cgps reports a 3D fix. However, I can't get chrony to see the GPS information.

# gpsd -ND 8 /dev/ttyUSB0
gpsd:INFO: launching (Version 3.17)
gpsd:IO: opening IPv4 socket
gpsd:SPIN: passivesock_af() -> 3
gpsd:IO: opening IPv6 socket
gpsd:SPIN: passivesock_af() -> 4
gpsd:INFO: listening on port gpsd
gpsd:PROG: NTP: shmat(4718600,0,0) succeeded, segment 0
gpsd:PROG: NTP: shmat(4751369,0,0) succeeded, segment 1
gpsd:PROG: NTP: shmat(4784139,0,0) succeeded, segment 2
gpsd:PROG: NTP: shmat(4816908,0,0) succeeded, segment 3
gpsd:PROG: NTP: shmat(4849677,0,0) succeeded, segment 4
gpsd:PROG: NTP: shmat(4882446,0,0) succeeded, segment 5
gpsd:PROG: NTP: shmat(4915215,0,0) succeeded, segment 6
gpsd:PROG: NTP: shmat(4947984,0,0) succeeded, segment 7
gpsd:PROG: successfully connected to the DBUS system bus
gpsd:PROG: shmget(0x47505344, 8936, 0666) for SHM export succeeded
gpsd:PROG: shmat() for SHM export succeeded, segment 4980753
gpsd:INFO: stashing device /dev/ttyUSB0 at slot 0
gpsd:INFO: running with effective group ID 20
gpsd:INFO: running with effective user ID 128
gpsd:INFO: startup at 2022-12-06T16:50:17.000Z (1670345417)

chrony.conf:

refclock SHM 0 poll 3 refid gps1
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
logdir /var/log/chrony
maxupdateskew 10
rtcsync
makestep 1 3
# chronyd -df /etc/chrony/chrony.conf
2022-12-06T16:52:15Z chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH +SIGND +ASYNCDNS +IPV6 -DEBUG)
2022-12-06T16:52:15Z Frequency -22.003 +/- 4.168 ppm read from /var/lib/chrony/chrony.drift
# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#? GPS0                          0   4     0     -     +0ns[   +0ns] +/-    0ns

I think the issue is related to shared memory since I think chrony/gpsd should be utilizing SHM ID 0 but it doesn't seem to exist.

# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 262144     localuser    600        67108864   2          dest         
0x00000000 229377     localuser    600        16777216   2          dest         
0x00000000 360450     localuser    600        524288     2          dest         
0x00000000 393219     localuser    600        524288     2          dest         
0x00000000 491524     localuser    600        524288     2          dest         
0x00000000 5177349    localuser    600        524288     2          dest         
0x00000000 5210118    localuser    600        524288     2          dest         
0x00000000 655367     localuser    600        524288     2          dest         
0x4e545030 4718600    root       600        96         2                       
0x4e545031 4751369    root       600        96         1                       
0x00000000 2293770    localuser    600        16777216   2          dest         
0x4e545032 4784139    root       666        96         1                       
0x4e545033 4816908    root       666        96         1                       
0x4e545034 4849677    root       666        96         1                       
0x4e545035 4882446    root       666        96         1                       
0x4e545036 4915215    root       666        96         1                       
0x4e545037 4947984    root       666        96         1                       
0x47505344 4980753    root       666        8936       1                       
0x00000000 5472274    localuser    600        16384      2          dest         
0x4e9c5038 5570579    root       600        96         0                       
0x00000000 5308436    localuser    600        532480     2          dest         
0x00000000 5341205    localuser    600        532480     2          dest         
0x00000000 5439510    localuser    600        16384      2          dest         
0x4ea05041 5603351    root       600        96         0           

I've tried starting chronyd before gpsd and that didn't help. Any ideas? Am I missing something obvious? Thanks in advance.

Similar question: Using gpsd and chrony without pulse per second

Another source I've read: GPSD Time Service HOWTO

glasstea
  • 41
  • 5

1 Answers1

3

Turns out that gpsd needed the -n flag. I added that in /etc/default/gpsd

       -n
           Don't wait for a client to connect before polling whatever GPS is associated with it.
           Some RS232 GPSes wait in a standby mode (drawing less power) when the host machine is
           not asserting DTR, and some cellphone and handheld embedded GPSes have similar
           behaviors. Accordingly, waiting for a watch request to open the device may save battery
           power. (This capability is rare in consumer-grade devices).

https://chrony.tuxfamily.org/examples.html#_server_using_reference_clock_on_serial_port

glasstea
  • 41
  • 5