Similar question was asked on Serverfault.com. This was the answer.
From the hwclock
man page on RHEL 4.6:
This mode (we'll call it "11 minute mode") is off until something turns it on. The ntp
daemon xntpd is one thing that turns it on. You can turn it off by running
anything, including hwclock --hctosys, that sets the System Time the old fashioned way.
To see if it is on or off, use the command adjtimex --print and look at the value of
"status". If the "64" bit of this number (expressed in binary) equal to 0, 11 minute mode
is on. Otherwise, it is off.
So by the virtue of you running hwclock --set
you have likely turned it off. By the same token you can check the output of the adjtimex --print
to confirm.
Problem solved.
Network issue
The VM had network issues preventing ntpd to succeed. It has two eth
interfaces, and the one with the gateway goes through a router we don't manage directly. Although my tests wouldn't show it, I guess some UDP frames were blocked. We set up another VM with another network config and ntpq
yielded better results.
Ultimately, we changed the ntp
config so that the host broadcasts time locally and all VM synchronize on it. Makes more sense and minimizes load on public ntp
servers.
ntpd
sets clock instantly after a few minutes
One thing that probably mislead me during the tests is that ntpd does not synchronize immediately. I thought it would detect a gap right away and then modify the clock speed so that the clock progressively joins the source clock. In fact, we noticed that (unless ntpd
is restarted) the clock is unchanged for a few minutes then all of a sudden it is set what seems instantly. In the meantime, the rightmost columns in ntpq
output show that synchronization is going on.
This ntpd
behavior probably explains why I thought ntpd
didn't work even if it did. I just didn't wait long enough and I didn't understand ntpq
output.
Best Answer
To check the status of
ntp
you should use:By modifying the
/etc/ntp.conf
you should restart the service through:The
ntpstat
reportUnable to talk to NTP daemon. Is it running?
, you can simply start thentp
service through:To start the service at boot time: