Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having trouble keeping the system clocks sync'd on a number of kvm guests. I've googled a fair bit, and found a lot of different options, many of which I've tried, to no avail. So here I am.

ntpd is out of the question (the host system runs it and the clock is always correct, but if you run it on the guests, the clock goes way out of whack).

The host is Ubuntu 9.04, kernel is 2.6.28-11-server The guests are Ubuntu 8.04, kernel 2.6.24-24-virtual

Here's the clocksource situation on the host:

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource 
tsc hpet acpi_pm jiffies 
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource 

And on the guest:

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource 
tsc pit jiffies 
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource 

I've got "clock=pit divider=10" in the kernel boot parameters on the guest. It still drifts. We're not talking massive drifts, but there is some.

Any suggestions? Has anyone had this problem and dealt with it?

share|improve this question

3 Answers 3

Fundamentally the clock is going to drift some, I think there is a limit to what can be done at this time. You say that you don't run NTP in the guests but I think that is what you should do, just make sure that you aren't referencing the local clock (comment out server 127.x.x.x) and that tinker panic 0 is set so that it won't freak out if there are large jumps it has to correct for. Thats basically the guidelines from the VMWare timekeeping paper and I would guess largely applicable to a KVM setup as well.

share|improve this answer
Hmm... I vaguely remember being told that when we did put ntp on the guests (pointing to a real ntp server, not localhost), the clock occasionally went completely haywire, setting the time backwards something like 20 years... That's all anecdotal though... maybe I'll give it another try myself and see what happens. –  Some Guy Oct 13 '09 at 17:08

The best option for a precise clock on the guest is to use the kvm-clock source (pvclock) which is synchronized with clock's host.

share|improve this answer
This is a good answer for newer systems, but is not available on older ones. –  mattdm Dec 7 '10 at 15:46
When does the guest sync with the hardware clock, isn't it only on boot? I don't think the clock source affects drift. –  Jack Douglas Jun 6 at 5:48

Here is a link to the VMware paper "Timekeeping in VMware Virtual Machines" (2008):

share|improve this answer

Your Answer


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.