Time synchronization in VMware guests

Submitted by dag on Tue, 2008/08/26 - 19:10

Have you ever been in this situation where the recommended solution is overly complex for a simple thing you want to do ?

Well, for a few months we have had issues with time synchronization on VMware guests. This is an old ESX 2.5 environment with fairly recent operating systems (RHEL4.6). The recommended way is to use clock=pit as a kernel boot parameter and to enable Host-Guest clock synchronization by either using vmware-toolbox (GUI!) or changing the .vmx files. In both cases a reboot is required for the time synchronization to kick in.

Now, this is all fine and dandy, but who the hell came up with a GUI for enabling this. Or even recommending people to go and find the .vmx file on one of the ESX servers. Very tiring...

Now today I felt ready for diving into the VMware GuestSDK and tracing vmware-toolbox to find how this communication between guest and host can cause the VMX file to be changed.

And lo and behold after 10 minutes of stracing and ltracing vmware-toolbox I found some string handling code that contained the pieces "vmx.set_option synctime 0 1". Obviously it did not took much help from Google to find the solution:

vmware-guestd --cmd "vmx.set_option synctime 0 1"

And lo and behold it works ! Swap the 0 and 1 to disable it again.

So the whole plan to implement my own tool and become rich overnight disappeared the same minute and I treated myself with a kit-kat instead.

VMWare Time synchronization

We ran into this same problem. I fixed it by installing the kernel-vm package from the CentOS testing repo on our linux guests. Did you try that? Is that the recommended way of doing it? Our Windows guests were not affected. All hosts are running CentOS 5.x.