2

I have an embedded Linux with busybox's ntpd. My ntpd.conf is

tinker panic 0
server pool.ntp.org iburst
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1
restrict -6 ::1

I've noticed that it is lacking the driftfile configuration line. It's not being assigned in the ntpd command line aswell, so what happens when I do not set a driftfile? Does ntpd have a default driftfile path or does it disable the driftfile control?

3

Browsing the busybox ntp sources seems to indicate that no driftfile is used, and the only options read from the conf file are the server lines.

  • Very good information, is there any other source where we can compare an actual driftfile usage? – natenho Sep 29 '15 at 15:25
  • As Gravy says in the comments, a driftfile is just an optimisation at startup. You should be able to get the full ntp sources from whatever OS you have, eg debian starts with these tar.gz sources – meuh Sep 29 '15 at 15:39
2

NTP does have the ability to run without a drift file, so if one is not specified, I believe you would be running without it.

from: http://doc.ntp.org/4.1.0/ntpd.htm

The ntpd behavior at startup depends on whether the frequency file, usually ntp.drift, exists. This file contains the latest estimate of clock frequency error. When the ntpd is started and the file does not exist, the ntpd enters a special mode designed to quickly adapt to the particular system clock oscillator time and frequency error. This takes approximately 15 minutes, after which the time and frequency are set to nominal values and the ntpd enters normal mode, where the time and frequency are continuously tracked relative to the server. After one hour the frequency file is created and the current frequency offset written to it. When the ntpd is started and the file does exist, the ntpd frequency is initialized from the file and enters normal mode immediately. After that the current frequency offset is written to the file at hourly intervals.

If you want to see if you have a drift file you can try the following and see what comes up:

locate ntp.drift
locate ntp/drift
locate drift

Not sure if you need to or not, but you can also configure this simply by adding: driftfile /var/lib/ntp/drift or some other path, to /etc/ntp.conf

The drift file is only actually read when ntpd starts. So essentially, if the file path isn't set, it will put you into that initialization mode for the 15 minute period each time the system reboots or the service is restarted, but once that is accomplished it should run as normal.

  • In my case, I could not find any drift file at all. The system does not have any...the text says "After one hour the frequency file is created" but, what if it doesn't have the drift path? It doesn't have the drift file path configured, so what it's going to do after one hour? – natenho Sep 29 '15 at 15:14
  • I can do some more research, but out of curiosity, Is this an Academic question, or is there a reason you don't want to set the driftfile path in the config file? – Gravy Sep 29 '15 at 15:19
  • I have a production system which I can't modify without a good reason :-). – natenho Sep 29 '15 at 15:20
  • Fair point. I know those restrictions well. From what I understand of it, the drift file is only actually read when ntpd starts. So essentially, if the file path isn't set, it will essentially put you into that initialization mode for the 15 minute period each time the system reboots, or service is restarted, but once that is accomplished it should run as normal. It may be worth it to submit a change request to whatever governing body controls the server state. As modifying that line would not require the server to go offline, and represents minimal risk. – Gravy Sep 29 '15 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.