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?

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.

  • 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. Oct 13, 2009 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.

  • This is a good answer for newer systems, but is not available on older ones.
    – mattdm
    Dec 7, 2010 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.
    – user83664
    Jun 6, 2015 at 5:48

Here is a link to the VMware paper "Timekeeping in VMware Virtual Machines" (2008): http://www.vmware.com/pdf/vmware_timekeeping.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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