During this season of giving, you can show your support for the NTP Project by making a donation to Network Time Foundation.

NTP Path Names

NTP has traditionally used a number of path names that, with the benefit of hindsight, would be different.

Whenever we have made the attempt to "fix" these issues, the pushback has been hard. So we have tried to come up with ways to satisfy both types of users.

Usually I have tried to keep the default paths the traditional ones. This has proven to be difficult. I'm now wondering if it might be better to have the default paths be the contemporary choices and document the way to get the software to install into the traditional locations.

What Traditional Desired Current solution or NotesSorted ascending
NTP statistics /var/NTP ${localstatedir}/log/ntp/ '-DNTP_VAR="/var/NTP/"'
ntp.kod /var/db ${localstatedir}/db/ntp/ Currently used by sntp. ntpd does not yet have a 'persistent state' file for KOD.
ntpd, ntpdsim, ntpdate,
ntpq, ntpdc, sntp=
bindir Depends on the OS Handled by sntp/loc/ files.
ntp.drift /etc ${localstatedir}/db/ntp/ No default; only used by example in the documentation
ntp.conf, ntp.keys,
ntp.audio, ntp.oncore*
/etc sysconfdir Will default to /etc

In NTP-BUG 382 noted below, comment #8, it says:

I'm thinking that it might be much easier to use a new variable, ntpconfdir, and it would legacy-default to /etc, and we can find a way to add ntpconfdir=etc to the sntp/loc/ files so different OSes could override this (I'd like to see the list of what the various OSes use for this now), and it would also allow local admins to override this value by supplying --ntpconfdir=XXX on the configure line.

The driftfile actually has no default value in the code. The only reason I can see to provide it is for the documentation, and it may be easier to just tell folks to look in the config file for the location of the drift file.

The biggest reason for the location of the statistics might also be for the documentation. I know we won't create a non-existing statistics directory.

Due to the hackery involved, the solution implemented in 4.2.7pXXX (not yet - certainly after p480) is to add lines like:

to sntp/loc/legacy, and for newer installations:

Of course, any paths may be used.

sysconfdir used to be difficult - before, we could not easily see if we're using the default value or one specified from the configure invocation. One solution to this would be to use ntpconfdir instead of sysconfdir, and we also need to consider if we should handle this by augmenting the information in the sntp/loc/ files. But now, we do have a way to see if the traditional autoconf directory variables have been overridden:

     test "$prefix" = NONE && prefix=/usr/share/local/gnu
     test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu
     test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
     test "$localstatedir" = '${prefix}/var' && localstatedir=/var

Related Topics: NTP-BUG 382 NTP-BUG 594 NTP-BUG 643 NTP-BUG 1056, NTP-BUG 2461

  • SNTP is a tear-off, and therefore the information needs to be in that subdir so it's also available in the event somebody only wants to distribute the SNTP code. We expect sntp to be part of the distribution. We also expect that some folks will only want SNTP. If somebody chooses to not install sntp that's their choice, but we still need it in the tree.

-- HarlanStenn - 03 Dec 2014

  • Since this involves much more than sntp, wouldn't it be advisable to move the files and related scripts up a directory level so that it doesn't appear to be sntp-specific?

There exist OS distributions that don't distribute (and probably don't care about) sntp.

-- BruceLilly - 03 Dec 2014

Whatever the mechanics, ntp violates the principle of least surprise: --prefix=/opt should cause ntpd to look for ntp.conf in /opt/etc, but does not.

Given the history and repackagers who rely on current behavior, I suppose a solution would be to document that one uses configure to move the default config file, with


or some such.

If that advice showed up from configure --help, I guess I['d be less unhappy.

Oddly enough, the default KEY file does seem to obey --prefix, so ntp is inconsistent.

Another thought:

What about adding --with-config-obeys-prefix, defaulting to '--without' ?

Then everyone can have what they want. To get standard behavior, add --with-config-obeys-prefix to your configure line; then everything works per the 'standard', including cross-builds and other wierd cases.

For compatible behavior, specify --without-config-obeys-prefix. Document that folks who want to continue to rely on the 'traditional' behavior should add this to their configure commands. Then in 5 years or so, the default can be flipped. smile

Once the C code knows to listen to configure, it becomes simpler, and configure can handle sorting out the options.

-- TlHackque - 16 Feb 2015

Topic revision: r17 - 15 May 2021, HarlanStenn
Copyright © by the contributing authors.Use of this website indicates your agreement with, and acceptance of, the PrivacyPolicy, the WikiDisclaimer, and the PrivateWebPolicy.