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"
orsudo 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?
Turn
ntpd
back on. It's job is to figure out how fast the clock is running and apply an appropriate correction.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.
The ntpdate command is a one-off. You want the ntpd daemon running to make minute adjustments.
Pay attention to the symbols on the left hand side of the output of ntpq. Those will tell you once you have a sync.