NTPD gets killed if offset is more than 1000 secs

Hi Team,

We are trying to configure NTP server and NTP client for time sync up in our Testing Envrinoment.

Below is our setup:

NTP Server - Linux Host PC (Ubuntu 14.04 LTS 64 bit)
NTP Client - Custom hardware based on imx6ul platform

Both Linux PC and board are connected to Ethernet hub and we are testing using static IP.
The configuration file ntp.conf file on server is modified to take local time of PC as NTP server time. The ntp.conf file at client is configured to sync up with PC server local time.
Here by I attached the ntp.conf files of both NTP server and client.

Current time in NTP Server is 12.00PM, we changed the time to 12.30PM in NTP Server side and we expect NTP Client to sync up, but it was not syncing even after 45mins.
We checked whether NTP Daemon(ntpd) is running using below command

# ps -ef | grep ntpd
user     4595  2469  0 10:33 pts/23   00:00:00 grep --color=auto ntpd

We found NTP daemon process got killed by itself without throwing any error or warning. We restared the NTP daemon(ntpd) in NTP Client using below command, then it got synced up successfully within 1 minute

Npw we changed the time from 12.30PM to 12.45PM in NTP Server, in that case, NTP Client got sync up properly[it took 15-20mins to sync up]. We checked ntpd process and it was running.
# ps -ef | grep ntpd
ntp 3583 1564 0 11:07 ? 00:00:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 117:126
user 4595 2469 0 11:43 pts/23 00:00:00 grep --color=auto ntpd

We found that if we give time offset difference within 17 minutes then NTP client syncing with NTP Server. But 17mins or more is given then ntpd is getting killed.

We gave less min poll(2) and max poll(2) values to more max poll(17) in NTP client configuration but behaviour is same.

What is causing this, what is the root cause for this error. Please let us know.

Requirement:

Our requirement is, NTP Client should sync up NTP Server for every 12 hours, we can’t do manual update using “ntpdate” as we need ntpd to do this automatically.

How we can achieve this ?

Please read the ntpd document first:

-g
Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, ntpd will exit with a message to the system log. This option can be used with the -q and -x options. See the tinker command for other options.

1000s = 16m40s. And I don’t know why you need to edit your server time again and again… If you insist on using ntpd (not ntpdate or sntp) to sync time then use the tinker command.

tinker [allan allan | dispersion dispersion | freq freq | huffpuff huffpuff | panic panic | step step | stepout stepout ]
This command alters certain system variables used by the clock discipline algorithm. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. Very rarely is it necessary to change the default values; but, some folks can’t resist twisting the knobs. Options are as follows:
panic panic
Specifies the panic threshold in seconds with default 1000 s. If set to zero, the panic sanity check is disabled and a clock offset of any value will be accepted.

Once NTP establishes its initial time-sync, it doesn’t expect the source to jump around by such a large amount, nor does it expect the local clock to have such a poor crystal oscillator.

Why every 12 hours? NTP adjusts its interval slowly as it is able to characterize the local clock and remote sources. A maxpoll of 15 = ~9.1hr intervals, or 16 = ~18.2 hr… Please don’t set a chronjob to poll the pool at exactly 12 hours, at the very least add some random delay.

As alicia said, the NTPD documentation explains all the commands you would need to use / adjust to allow larger offsets and to step the time (if that’s what you want) vs slewing.

If you are only going to have very intermittent network access, you might also want to take a look at chrony as a possible choice for your timekeeping goals.

And I don’t know why you need to edit your server time again and again

We are in network where sometimes we configure our Hardware platform(i.MX6UL) as NTP Server and Linux PC will be configured as NTP Client. Our hardware platform time runs in External RTC, so we will be setting the time manually whenever there is a deviation.
So when we set NTP Server(i.MX6UL) date and time, offset will vary and will be more than step threshold(1000sec) sometimes, we will just restart the service after changing NTP server time, but we will not reboot the Linux PC(we know that after booting, NTP time sync up will happen once but we wont restart)
So we want NTP Client(Linux PC) to sync up with NTP Server no matter how big the deviation is. This is the reason why we change NTP Server time often.

If you insist on using ntpd (not ntpdate or sntp) to sync time then use the [ tinker command]

tinker with what option, I saw that if we use tinker panic, then ntpd is not getting killed even if exceeds step threshold but I am observing that NTP Client takes more hours to get sync up with NTP Server if we use tinker panic command. Is this behaviour expected ?

Is using tinker is bad for ntpd ?