Fixing VMware clock synchronization problems

On a VMWare environment sometimes guest operating systems may experience synchronization problems resulting into wrong dates and/or times. This could be more than annoying.

From Timekeeping in VMware Virtual Machines, page 14:

VMware Tools includes a time synchronization feature that periodically checks the guest operating system clock against the host operating system clock and corrects the guest clock. Unlike non-VMware synchronization software, VMware Tools time synchronization works in concert with the built-in catchup feature in VMware virtual machines and avoids turning the clock ahead too far. To enable VMware Tools time synchronization in a guest, first install VMware Tools in the guest operating system. Next, check that time synchronization is turned on. You can enable synchronization from the graphical VMware Toolbox application within the guest. Alternatively, you can set the .vmx configuration file option tools.syncTime = true to enable time synchronization. Note that time synchronization in a Linux guest works even if you are not running the VMware Toolbox application. All that is necessary is that the VMware guestd process is running in the guest and tools.syncTime is set to true.

VMware Tools time synchronization is designed to be a second line of defense to deal with special cases where a guest operating system’s clock falls behind real time despite the built-in catchup mechanism provided in the virtual machine. It is normal for a guest’s clock to be behind real time whenever the virtual machine is stopped for a while and then continues running; in particular, after a suspend/resume, snapshot, disk shrink, or VMotion operation. These are the main cases that VMware Tools time synchronization is meant to handle. The guest’s clock may also fall behind in less common circumstances, such as under heavy load when the guest has not been able to get enough CPU time to handle all its timer interrupts. The VMware Tools time synchronization daemon is quite simple and has a few limitations. The daemon checks the guest clock only once per minute. If the guest clock is much farther behind the host time than the virtual machine’s built-in catchup mechanism expects it to be, the daemon resets the guest clock to host time and cancels any pending catchup. For most guest types, the daemon never turns the guest clock backward, even if the guest’s clock time is running ahead of real time. Turning the clock backward is seldom needed and can cause some guest software to become confused. If your guest’s clock is running ahead of real time, see Known Issues and Troubleshooting on page 18 for troubleshooting tips and potential solutions and workarounds.

Solution
Install VMware Tools and have the Virtual Machine synchronize its clock with the Host Machine’s (keep in mind that this might bring issues if the host and the guest are in different timezones because the guest will get the exact host’s time).

You may proceed by stopping the Virtual Machine and then editing the configuration file (xxxxxx.vmx) on the host machine, setting:

tools.syncTime = "true"

After that, you may start the Virtual Machine. The clock should now keep synchronized.

References


Posted

in

by

Comments

0 responses to “Fixing VMware clock synchronization problems”

  1. Jair Avatar

    I changed the line on the vmx file => tools.syncTime = “true” but the virtual machine still run a minute or two behind the time of the host. I look at the time zone and they host and vm are identical.

    But it looks like after a couple of minutes the time catch up and synchronize with the host. Interesting… previously to this I was using an ntp synchronixation on the vm and the host was the ntp server. Works fine for one hour or two then the vm stop running ntp server service and the time gets all over the place.

    I will keep monitoring the behavior and let you know.

    Thank you very much,

  2. unai Avatar

    Good to know, you are welcome 🙂

  3. Tim Avatar
    Tim

    that’s great, but it doesn’t address the issue with the vmware tools time sync. The time gets sped u ptoo far and the VM’s usually end up several minutes ahead of real time. Can anyone offer ideas about how to deal with this? Is it better to just stay with windows time sync and scale up the rate of sync-ing?

  4. unai Avatar

    Dear Tim,

    Could you please specify what version of VMware you are using, under what host operating system and guest operating system? I have not updated this article in a while and I have some more “meat” to add. I think is time to it.

    Thank you so much,
    unai

  5. […] covered on a previous post how to keep the clock synchronized for VMware Linux guest(s). Well this seems to not work at least […]

  6. AdminIMGE Avatar

    This caused us a lot of grief so I am posting the solution that worked in our case. It happened to be a processor issue:

    In my case we are running VMWare Server 2.02 on Windows Server 2003 R2 Standard. The Host is also Windows Server 2003 R2 Standard. I had the VMware Tools installed and set to sync the time. I did everything imaginable that I found on various internet sites. We still had horrendous drift, although it had shrunk from 15 minutes or more down to the 3 or 4 minute range.

    Finally in the vmware.log I found this entry (resides in the folder as the .vmx file): “Your host system does not guarantee synchronized TSCs across different CPUs, so please set the /usepmtimer option in your Windows Boot.ini file to ensure that timekeeping is reliable. See Microsoft KB http://support.microsoft.com/kb… for details and Microsoft KB http://support.microsoft.com/kb… for additional information.”

    Cause: This problem occurs when the computer has the AMD Cool’n’Quiet technology (AMD dual cores) enabled in the BIOS or some Intel multi core processors. Multi core or multiprocessor systems may encounter Time Stamp Counter (TSC) drift when the time between different cores is not synchronized. The operating systems which use TSC as a timekeeping resource may experience the issue. Newer operating systems typically do not use the TSC by default if other timers are available in the system which can be used as a timekeeping source. Other available timers include the PM_Timer and the High Precision Event Timer (HPET). Resolution: To resolve this problem check with the hardware vendor to see if a new driver/firmware update is available to fix the issue.

    Note The driver installation may add the /usepmtimer switch in the Boot.ini file.

    Once this (/usepmtimer switch) was done the clock was dead on time.