Setting up a GPS with chronyd on CentOS 7

Install gpsd and chrony (chrony should already be installed)

Connect your GPS and determine its device name. If it is a USB GPS, the easiest way to do that is to do an ls in /dev, then plug in the device, and do another ls and see what changes. The device name will likely be /dev/ttyUSB0 or /dev/ttyACM0.

Add/modify the OPTIONS line in /etc/sysconfig/gpsd

OPTIONS="-n /dev/ttyACM0"

You can test to make sure you have a GPS connection with the gpsmon or cgps commands.

Next is to set chrony to use the GPS. I was not able to get it to use the socket file (I still have no idea why it would not work), so I ended up using the shared memory method. I added the line:

refclock SHM 0 refid GPS precision 1e-1 offset 0.00065 trust 

The offset value I got by watching the time the GPS provided against the time coming from pool.ntp.org servers and seeing how far off it is on average. Since there is a small delay introduced by the USB–>Serial connection, this makes sense.

My GPS does not have the PPS (pulse per second) signal on it, so I could not test that method of communicating with the GPS.

Restart chronyd and gpsd, and then you can check that chrony is using with the command

chronyc sources -v

Leave a Comment