ntp.drift file not present


Ref. https://dietpi.com/forum/t/ntpd-setup/188/1

Using V140 on rpi3

I see that there is no ntp drift file present in /var/lib/ntp and one does not get created there. I don’t know if this is a permissions thing. ntp owns the directory, but root is running ntpd.

I tried adding the file to the directory but it is not updating it. I put a drift number into the drift file and on start up it is being read and applied.

Not sure what is going on here.
Gordon Williams

Hi Gordon,

Just looking through notes:

		#NTPD drift file ownership must match user that NTPD runs as, or it wont write to drift file (even though its ran as root.......)
		chown root:root /var/lib/ntp/ntp.drift

Still failing to create/update drift file. I’ll look into it:

Hi Gordon,

In the next update (v142), we will make the move from NTPD to systemd-timesyncd for Daemon + Drift mode. Tested and works a treat:

Hmm, not sure. Your drift is 0 ppm in the above example. Where is the drift file? Any man pages that I have been able to see are short on details. Do you have a good description?

What I’m doing is setting up the clock to run within a few ppm of drift from atomic time over a large temperature range when the rpi is not connected to the internet. It is for a timing application.

The clock calibration procedure is:

  1. start ntpd with ntp.conf file modified for local atomic ntp servers.
  2. Let run over a period of time like a 1/2 day.
  3. Determine the drift using ntptime. This drift number should be written in the drift file every hour but it is not. I add this manually to the drift file.
  4. Stop ntpd
  5. then to check cal - run ntpdate -q some-server-names to determine the baseline offsets for each of the ntp servers
  6. Repeat 5) a few hours later to ensure that the time drift is small and within my expectations.

For use:

  1. run ntpd -gq to start, apply drift from drift file, get time if internet available, and stop
  2. set time if not done in 1)

Related - ntpdate has been deprecated, but I haven’t been able to find a new tool that does the job of ntpdate -q that compares the system clock against ntp servers without making any changes to the system clock. ntpdate doesn’t need ntpd running while things like ntpdc dmpeers needs ntpd running which changes the clock and wrecks the offset drift test.

My needs are not typical so don’t go changing things around just for me. :slight_smile:
Gordon Williams