GPSD를 Chronyd 소스로 사용할 때 발생하는 문제

GPSD를 Chronyd 소스로 사용할 때 발생하는 문제

Ubuntu 18.04의 유일한 시간 소스로 PPS 동글 없이 USB GPS를 사용하려고 합니다. cgps가 3D 수정을 보고하므로 GPSD가 제대로 작동하는 것 같습니다. 하지만 GPS 정보를 제때에 볼 수 없었습니다.

# 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

chrony/gpsd가 SHM ID 0을 활용해야 한다고 생각했기 때문에 이 문제는 공유 메모리와 관련된 것 같지만 존재하지 않는 것 같습니다.

# 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           

gpsd 전에 chronyd를 시작해 보았지만 도움이 되지 않았습니다. 어떤 아이디어가 있나요? 나는 분명한 것을 놓치고 있습니까? 미리 감사드립니다.

유제: gpsd 및 chrony를 사용하면 초당 펄스가 없습니다.

내가 읽은 또 다른 출처: GPSD 시간 서비스 안내

답변1

gpsd에는 -n 플래그가 필요하다는 것이 밝혀졌습니다. /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

관련 정보