Solved ntpd failure

sdf

Active Member

Reaction score: 3
Messages: 170

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,083
Messages: 31,689

Check /var/log/messages for errors.
 
  • Thanks
Reactions: sdf
OP
OP
S

sdf

Active Member

Reaction score: 3
Messages: 170

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
 

mb2015

Member

Reaction score: 16
Messages: 63

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.
 

jpierri

Member

Reaction score: 22
Messages: 57

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

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,083
Messages: 31,689

you must restart the server to pick up the changes, e.g. service restart ntpd
Good suggestion but the command is in the wrong order, it's: service ntpd restart.
 
Top