ntpd configutration -- a small suggestion from the peanut gallery

Per Hedeland per at hedeland.org
Fri Jun 7 14:59:47 UTC 2019

On 2019-06-07 16:04, Arthur Chance wrote:
> On 07/06/2019 09:57, Dave Cottlehuber wrote:
>> On Thu, 6 Jun 2019, at 18:14, RW via freebsd-questions wrote:
>>> On Wed, 5 Jun 2019 08:40:51 +0200 (CEST)
>>> Trond Endrestøl wrote:
>>>> On Tue, 4 Jun 2019 23:18-0700, Ronald F. Guilmette wrote:
>>>>> I feel sure that I'll be able to figure out how to get ntpd properly
>>>>> enabled & configured, but I would just like to offer, hunbly, to the
>>>>> Powers That Be, that it would be Nice if ntpd, once enabled during
>>>>> install, just worked, you know, right outta the box.
>>>> Adding
>>>> ntpd_sync_on_start="YES"
>>>> to /etc/rc.conf is one way.
>>> Perhaps it should be the default.
>> It is in CURRENT[1] & would be worth MFC although possibly too late
>> for 11.3R.
>> https://www.freebsd.org/cgi/man.cgi?query=ntpdate mentions:
>>       Note: The functionality o this program is	now available in the ntpd(8)
>>       program.  See the -q command line option in the ntpd(8) page.  After a
>>       suitable period of	mourning, the ntpdate utility is to be retired from
>>       this distribution.
>> Perhaps a revision that uses ntpd_flags would be better?
> There is one advantage to using ntpdate_enable="YES" rather than
> ntpd_sync_on_start="YES" and that's the fact that ntpdate is blocking.
> When the rc script finishes you know the clock is correct, whereas with
> ntpd_sync_on_start the time step can be some time after the script has
> returned. If you run a daemon like dovecot that objects to time going
> backwards (and dies) that can be a problem.

Yes, this is a very big advantage - it can take a *very* long time for
ntpd to get the clock correct, with or without the -g option a.k.a.
ntpd_sync_on_start, and there is no straightforward way to find out
when it has happened. But in fact the reference implementation folks
do not suggest that 'ntpd -g' can be a replacement for ntpdate - as
you can see in the ntpdate man page excerpt above, it points to the
*-q* option to ntpd.

This option is not something you can put in ntpd_flags though, see the
ntpd man page - i.e. the idea is that you run 'ntpd -q', which is
blocking, and "pretty fast", instead of ntpdate, and when it completes
you start the ntpd daemon with whatever *other* flags you want (-g can
still make sense there, in case the 'ntpd -q' failed somehow).

However ntpdate is still typically significantly faster than 'ntpd -q',
and in case ntpdate ever gets removed from the reference distribution
(it's still present in the latest version of their development
branch), I would actually hope that FreeBSD retains it and continues
to make it available as an rc.conf option.


>> --panicgate
>> [2]: https://www.freebsd.org/cgi/man.cgi?query=ntpd
>> [1]: https://svnweb.freebsd.org/base?view=revision&revision=r326095
>> Author: manu <manu at FreeBSD.org>
>> Date:   Wed Nov 22 15:27:47 2017 +0000
>>      bsdinstall: Add ntpdate option
>>      When you install a computer for the first time, the date in the CMOS sometimes
>>      not accurate and you need to ntpdate as ntpd will fail a the time difference
>>      is too big.
>>      Add an option in bsdinstall to enable ntpdate that will do that for us.
>>      Reviewed by:    allanjude
>>      Differential Revision:  https://reviews.freebsd.org/D13149

More information about the freebsd-questions mailing list