Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am seeing a very severe clock drift on my Xen HVM VPS, rented from a hosting provider, so I don't have access to the dom0 system. I continuously run ntpd, but the clock drifts by as much as 30 seconds in 5 minutes and NTP cannot keep up. Has anyone experienced this?

Here are some details:

$ dmesg | grep clock
[    0.160000] Measured 347 cycles TSC warp between CPUs, turning off TSC clock.
[    0.396000] * this clock source is slow. Consider trying other clock sources
[    0.550448] Switching to clocksource acpi_pm
[    0.653135] rtc_cmos 00:05: setting system clock to 2011-03-09
02:45:40 UTC (1299638740)

$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource 
acpi_pm

$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource 
acpi_pm
share|improve this question
    
You could use the tinker panic 0, and tinker step options in your ntp.conf. This will allow it to make corrections faster. Not sure what you need to do to fix the real problem though. –  Zoredache Mar 9 '11 at 21:24

2 Answers 2

I recall that being an issue in guests some time back, but I couldn't recall how to get around it or fix it. So I googled and got this solution.

Uninstall openntpd

Then create a cron job with the following script.

#! /bin/bash
# This is a DIRTY hack to allow have time settings correctly on Xen guests
# clopez@igalia.com
echo 1 > /proc/sys/xen/independent_wallclock
ntpdate -b pool.ntp.org 0.debian.pool.ntp.org hora.roa.es
echo 0 > /proc/sys/xen/independent_wallclock

This is based on the advice from this link: http://blog.neutrino.es/2010/workaround-for-the-time-drift-issue-on-xen-keep-your-guests-synced/

Let me know if it works for you.

share|improve this answer
    
Thanks for the reply. I have since left the VPS provider that had this issue so I cannot say whether this works or not, but it sounds plausible. I cannot accept an answer as I cannot verify, but have an upvote. –  ipartola Jul 18 '13 at 15:28

Add this line to the beginning of ntpd.conf:

tinker panic 0

That will help it keep up. Here is a link to the vmware best practices for timekeeping. I know you're not using vmware, but much of it should still be applicable.

share|improve this answer
    
For whatever reason that doesn't work: Restarting openntpd: /etc/openntpd/ntpd.conf:16: syntax error Which is the line on which I added tinker panic 0. I am using openntpd 3.9p1+debian-5 on Ubuntu 10.10 2.6.35-22-generic-pae i686. –  ipartola Mar 9 '11 at 21:35
    
I missed the part about openntpd. Losing ticks is common (and nearly unavoidable) in a virtual world. You're going to need to get ntp to keep up somehow. Can you run "regular" ntpd on the box? –  Chris Mar 9 '11 at 21:50
    
Yes, I installed ntp instead of openntpd and added the "tinker panic 0" line to the config file; then restarted ntpd. So far the time has not changed. –  ipartola Mar 9 '11 at 22:41
    
By "not changed" do you mean in the good way or the bad way? –  Chris Mar 10 '11 at 15:23
    
Sorry for the confusion. I mean in a bad way: as in the time is still wrong. –  ipartola Mar 23 '11 at 15:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.