ntpd configutration -- a small suggestion from the peanut gallery

Matthias Oestreicher matthias at smormegpa.no
Wed Jun 5 19:41:29 UTC 2019

Am Mittwoch, den 05.06.2019, 10:28 -0700 schrieb Ronald F. Guilmette:
> In message <c705f5737cf441abe1b039b5d212ca34e98360d8.camel at smormegpa.no>, 
> Matthias Oestreicher <matthias at smormegpa.no> wrote:
> > NTP works out of the box, but does not accept big time changes unless you run it
> > with
> > the -g option. I think it's not ntp's fault.
> OK.   Thanks.  It now appears that this was indeed the issue, and I did
> need the -g option.  The ntpd daemon -was- dying entirely, shortly after
> starting up, but now I have run it manually with the -g option and also
> with the other options that it normally gets when it has been started
> via "/etc/rc.d/ntpd start" and now all seems to be well.
> (Apparently, adding ntpd_sync_on_start="YES" to /etc/rc.conf is the
> particular magic that should be used to cause ntpd to always be started
> with the -g option, which suits me just fine.  I'm not sure why this
> isn't used by default, but I guess that some folks are a lot more
> worried about their time getting set wrong somehow than I am.)
> Just one more small thing... The man page for ntpd says, very explicitly,
> undetr the description of the -g option, that when and if ntpd finds
> that the time adjustment needed is too big, it will exit *and*  also
> write a message (presumably explaining why it did that) to "the system
> log".  I am assming that for a fresh new system that has not yet been
> fiddled too much, that means the message in question... which explains
> why ntpd has elected to commit suicide... should appear in the
> /var/log/messages file.  Certainly I *am* seeing other messages from
> ntpd in that file.  But I am quite certainly *not* seeing any message
> in that file and tagged with the name "ntpd" that mentioned either that
> ntpd was electing to commit suicide *or* the reason why it might be
> doing so.
> Did I just miss those ntpd death messages somehow?
Sorry, I've never seen ntpd exit due to too big offset and I don't know how that would
show in /var/log/messages.

Anyway, even if it seems to work now, I'd check if your time is based on localtime or
GMT. It's recommended to use GMT, I never use localtime personally.

In your original question you said:"off by several hours" and that's usually caused by
having FreeBSD configured to use localtime, while the hardware clock in the BIOS is set
to GMT (or maybe the otherway around). This happend to me once, when I accidentally
chose localtime during install, while I had BIOS clock set to GMT. I was totally
confused and wondered where that offset came from, until I got the hint to remove
/etc/wall_cmos_clock on the forums.

That said, check if the file /etc/wall_cmos_clock exists and if, remove it (it's an
empty file).
Normally, neither the -g option nor sync_on_start should be needed, if the hardware
clock in your computer's BIOS is correctly set to GMT. Doesn't hurt to use them, but if
ntpd does not work without, I'd check the clock.

Open www.greenwichmeantime.com on your cellphone and set your BIOS clock to what it
shows under "GMT now".
Then you'll normaly get no more then a few seconds off, which ntpd handles without the
need to accept big changes.

Hope this helps you a little bit to understand what's going on.

More information about the freebsd-questions mailing list