6

I'm having some strange problem with the clock on my server – it's about 10% faster than normal.

The problem started 2 days ago and I've not done anything special with the server.

I tried to turn of the ntp update by stopping the ntpd daemon.

It looks like the hardware clock is disabled.

→ sudo hwclock --show
select() to /dev/rtc to wait for clock tick timed out
  • Server has not been restarted for 100+ days
  • Linus distro is Debian squeeze/sid
  • ntpd daemon is turned of
  • Server is a VPS, non of the other customers have had any problem
  • I've not changed anything related to the clock in terms of software
  • Running sudo date -s "Sun Feb 5 00:30:15 CET 2012" or sudo ntpdate -b prrr.se, fixes the problem temporarily

I tried to mesure the offset by using ntpdate -b prrr.se. This is the result

After 5 sec

→ sudo ntpdate -b prrr.se
 5 Feb 00:19:54 ntpdate[24137]: step time server 178.78.255.254 offset -1.179405 sec

After 10 sec

→ sudo ntpdate -b prrr.se
 5 Feb 00:20:04 ntpdate[24142]: step time server 178.78.255.254 offset -2.480711 sec

After 20 sec

→ sudo ntpdate -b prrr.se
 5 Feb 00:20:24 ntpdate[24149]: step time server 178.78.255.254 offset -4.680055 sec

Can anyone explain to me why this is happening and what might be the solution?

3 Answers 3

3

Turn ntpd back on. It's job is to figure out how fast the clock is running and apply an appropriate correction.

7
  • But it hasn't been working for over 24h now – using the ntpd daemon. Feb 5, 2012 at 1:56
  • Your question says the NTP daemon is off. If it's on, then how is it configured? And what does its monitoring say? Feb 5, 2012 at 2:15
  • Yes, I turned it off, just for debugging. Before that it was on for about 400 days. This is my config file: gist.github.com/a7c061f77e765216f6cf What did you mean by "monitoring"? Feb 5, 2012 at 3:17
  • NTPD has sophisticated monitoring that allows you to tell if it's able to community with its peers or servers, which one it has chosen to sync with, whether it actually is in sync, and so on. If you normally run with NTPD on, what's the point of debugging with it off? You should be debugging the configuration you run. Feb 5, 2012 at 4:06
  • @Oleander Depending how your NTP is configured it can either reset or slew the time. If it does the latter it usually has a configuration to stop updates if the clock drifts away longer then particular amount. Secondly depending on virtualization software used you may have sync to host problem.
    – Karlson
    Feb 5, 2012 at 6:20
3

Virtual servers have notoriously unreliable clocks, since they don't get reliable ticks from the CPU. They're even worse than the clocks in physical machines. It depends mostly on the load of the hypervisor your VPS is running on, so maybe you're seeing more drift since the load of the physical server has increased.

Simply enable NTPD, and point it to some NTP servers. NTP will figure out how fast your clock drifts, and will slow it down by the right amount. It will periodically monitor and adjust these values, leading to very accurate time. The NTPD daemon takes few resources and is very effective, so I would suggest just enabling it.

4
  • +1. Exactly. I virtualize prettym uch all of my infrastructure EXXCEPT.... machine uses to handle real time data feeds. Beacause the closk i RIDICULOUS and when you measure latency in a network etc. - it just starts alawrms every second. It cflucuates like 3-4 seconds per minutee back and forth.
    – TomTom
    Feb 5, 2012 at 8:21
  • Also see this vmware's KB: kb.vmware.com/selfservice/microsites/…
    – Jure1873
    Feb 5, 2012 at 10:40
  • This answer still doesn't change the fact that the ntp daemon isn't working. Feb 5, 2012 at 14:07
  • What do you mean 'not working'? You mentioned it was turned off. What happend when you enable it? Feb 5, 2012 at 23:07
1

The ntpdate command is a one-off. You want the ntpd daemon running to make minute adjustments.

# /etc/init.d/ntpd stop
# ntpdate time.nist.gov
# /etc/inid.d/ntpd start
# watch 'ntpq -pn'

Pay attention to the symbols on the left hand side of the output of ntpq. Those will tell you once you have a sync.

3
  • I'm not sure what to look for. The current time is shown to the right. Which isn't correct after a while. The only thing to the left is Every 2.0s: ntpd -pn. Feb 5, 2012 at 3:20
  • So ask NTPD what it's doing, what server it's synchronized with, whether it was able to reach it, and so on. Feb 5, 2012 at 4:08
  • Typo, fixed. You want ntpq -pn.
    – dmourati
    Feb 5, 2012 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .