Solved ntpd failure

Hello everyone, my ntp server failed.

Configuration is as follows:

/etc/rc.conf
Code:
ntpd_enable="YES"

It was normal at the beginning, but ntpd did not run afer the system rebooted.

Code:
# service ntpd status
ntpd is not running.
# service ntpd start
ntpd is running as pid 752.

But after 3-5 seconds, it stops again. Why?

Thanks.
 
Check /var/log/messages for errors.
It said,
Code:
ntpd: line 51 column 28 syntax error unexpected T_String, expecting T_EOC
ntpd: syntax error in /etc/ntp.conf line 51, column 28

This is the line 51, "prefer" is the column 28. (line 51 - 53)
Code:
server time.nist.gov iburst prefer
server ntp1.net.berkeley.edu iburst
server ntp2.net.berkeley.edu iburst
 
One thing that wasn't mentioned is that after editing ntpd.conf, you must restart the server to pick up the changes, e.g. service restart ntpd

Not sure if that was the issue or what.
 
Now, manually specifying time by date command, it is back to normal.

On ntpd() you will find that
... to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set an error greater than 1000s will cause ntpd to exit anyway.
Meaning that, if the hardware clock is more that 1000 seconds late or early, the ntpd will just exit without doing anything.

As you said that
It was normal at the beginning, but ntpd did not run afer the system rebooted.
and
But after 3-5 seconds, it stops again.
it is quite possible that your hardware clock bias was exceeding that 1000 seconds limit.
 
  • Thanks
Reactions: sdf
Back
Top