3

With the arrival of Raspbian Stretch, ntpd is replaced by systemd-timesyncd. I used to be able to sync the system clock with GPS time by adding a few lines to /etc/ntp.conf. Anyone has any clue how to do the same on systemd-timesyncd?

Nick Lee
  • 133
  • 1
  • 4

1 Answers1

2

Looks to me like it probably doesn't ("more complex use cases are not covered by systemd-timesyncd"). If not, you could look into replacing it with chronyd and gpsd.

If above you click though Documentation->chrony.conf (actually a man page, if installed it would be man chrony.conf; the daemon is man chronyd) and search down for "Unix domain socket driver", you'll see:

SOCK

Unix domain socket driver. It is similar to the SHM driver, but samples are received from a Unix domain socket instead of shared memory and the messages have a different format. The parameter is the path to the socket, which chronyd creates on start. An advantage over the SHM driver is that SOCK does not require polling and it can receive PPS samples with incomplete time. The format of the messages is described in the refclock_sock.c file in the chrony source code.

An application which supports the SOCK protocol is the gpsd daemon. The path where gpsd expects the socket to be created is described in the gpsd(8) man page. For example:

refclock SOCK /var/run/chrony.ttyS0.sock

This is an option for the refclock parameter. Meanwhile, according to this:

gpsd, when run as root, feeds reference clock information to chronyd using a socket named /var/run/chrony.ttyXX.sock (where ttyXX is replaced by the GPS receiver’s device name. This allows multiple GPS receivers to feed one chronyd.

I imagine this is similar to how you were doing it before, and if so of course it might be easiest if you just install ntpd (I am sure it is available as an option; timesyncd looks like it is being used in base Debian as a simpler default, although it might be considered a poor choice in Raspbian).

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • Thanks for confirming my suspicion that systemd-timesyncd cannot do the same. I will install ntpd myself and go back to my old way. Also thanks for informing me of the chronyd way. It gives me another option. – Nick Lee Oct 14 '17 at 02:47
  • 1
    The package names are gpsd but chrony (no d) and ntp (no d). – Thomas Weller Apr 10 '18 at 10:19