Configuring GPSD and Chrony for stratum 1 NTP service on a Proxmox system can cause some problems. I tried it this morning and after some hair-pulling, got it to work. The main issue seems to be that gpsd doesn't always work well with systemd, and there's something in the Proxmox OS that triggers that problem. The solution is simply to not run gpsd from systemd, but instead start it from an old-fashioned init script. Here are steps that worked for me on Proxmox 8.3.
1. Install gpsd and pps-tools.
2. Disable systemd for gpsd and gpsd.socket:
systemctl stop gpsd
systemctl stop gpsd.socket
systemctl disable gpsd
systemctl disable gpsd.socket
3. Connect GPS with NMEA data at 9600 baud and PPS on the DCD pin.
4. Check to see if /dev/ttyS0 and /dev/pps0 show up in dmesg. If not, troubleshoot that.
5. Copy the attached "gpsd-custom.txt" into /etc/init.d/ as "gps-custom". Change the device from /dev/ttyS0 to whatever is correct for your GPS receiver.
6. chmod +x gps-custom
7. update-rc.d gpsd-custom defaults
That should be enough to get GPSD going at run time. However, it can take a little while for PPS to start arriving and chrony will exit if it can't catch the GPS data. The symptom is that running "chronyc sources" returns an error. This may not be the best solution, but I added "ExecStartPre=/bin/sleep 10" to /etc/systemd/system/chronyd.service to cause it to sleep for 10 seconds and that seems to work here.
Now, add lines to /etc/chrony/chrony.conf to have it use the GPS as a time source:
refclock PPS /dev/pps0 lock NMEA offset 0.0 refid PPS
refclock SHM 0 offset 0.0 delay 0.2 refid GPS
(The refclock offset and delay values are a swag; you can tweak them as you see what offsets chrony is reporting.)
After rebooting, you should have chrony running as a stratum 1 time server. If you have suggestions to do this better, please let me know.
1. Install gpsd and pps-tools.
2. Disable systemd for gpsd and gpsd.socket:
systemctl stop gpsd
systemctl stop gpsd.socket
systemctl disable gpsd
systemctl disable gpsd.socket
3. Connect GPS with NMEA data at 9600 baud and PPS on the DCD pin.
4. Check to see if /dev/ttyS0 and /dev/pps0 show up in dmesg. If not, troubleshoot that.
5. Copy the attached "gpsd-custom.txt" into /etc/init.d/ as "gps-custom". Change the device from /dev/ttyS0 to whatever is correct for your GPS receiver.
6. chmod +x gps-custom
7. update-rc.d gpsd-custom defaults
That should be enough to get GPSD going at run time. However, it can take a little while for PPS to start arriving and chrony will exit if it can't catch the GPS data. The symptom is that running "chronyc sources" returns an error. This may not be the best solution, but I added "ExecStartPre=/bin/sleep 10" to /etc/systemd/system/chronyd.service to cause it to sleep for 10 seconds and that seems to work here.
Now, add lines to /etc/chrony/chrony.conf to have it use the GPS as a time source:
refclock PPS /dev/pps0 lock NMEA offset 0.0 refid PPS
refclock SHM 0 offset 0.0 delay 0.2 refid GPS
(The refclock offset and delay values are a swag; you can tweak them as you see what offsets chrony is reporting.)
After rebooting, you should have chrony running as a stratum 1 time server. If you have suggestions to do this better, please let me know.