Fix for VMWare time drift problems

Posted on 2009-11-04

I have a VMWare image that does some processing and then upload the results to Amazon S3. The upload has a crypto signature that includes a timestamp, and if the time of the machine is too far from reality, the upload fails. The VMWare instance was drifting by more than 10 seconds per minute.

Both the host and the guest are Debian 4.0 (Etch), and the host has multi-core with multiple CPUs.

Switch the guest to look at a different clock source: Edit /boot/grub/menu.lst and add divider=10 clocksource=acpi_pm to the line that starts with # kopt=.

Run update-grub. This re-does the menu entries to have the new options.

Set the guest to sync to the host's time using VMWare Tools' time sync. On the host edit the _guest_.vmx file and add/change tools.syncTime = "TRUE" and tools.syncTime.period = 60.

Restart the VM. cat the file /sys/devices/system/clocksource/clocksource0/current_clocksource to make sure it is in fact using `acpi_pm.

Side note: it may be better to use NTP to sync the time, but only if you add tinker panic 0 to the top of /etc/ntp.conf. I didn't find this until after I had the VMWare host time sync working, so I have not tried it.

References: VMWare KB article on Linux settings, VMWare KB article on timekeeping

Tags: vmware ntp time