Sunday, March 25, 2007

FreeBSD 6.x clock problem in VMware

fix slow clock problem for FreeBSD 6.x in VMware by adding following line to "/boot/loader.conf" and then reboot FreeBSD.
hint.apic.0.disabled=1

Sync the clock by using "/usr/sbin/ntpdate" or modify following line in the VMX file on host OS,
tools.syncTime="TRUE"

Update:
Thanks to jiashiun's comment.

vmtools should be installed to activate time-sync between host and client OS, after 'tools.syncTime="TRUE"' been inserted into VMX file.

there is some problem for FreeBSD to detect the clock frequency via APIC (I think), no matter there is vmtools or not. That's why we have to insert hints in "loader.conf".

2 comments:

jiashiun said...

不是在vm裡裝 vmware tools 就好了嗎? 雖說它的 guestd 應該也是不斷去校時...

jiashiun said...

The main cause is that VM shares CPU time with host. So VM may lost some clock count. See VMware Time Sync and Windows Time Service for some background info.

Since FreeBSD 6.0 kern.hz is raised from 100 to 1000. That makes the clock skew more obvious. Changing it back to 100 will help, but in case of running CPU-intensive tasks on host, the clock of VM still slows down.

After installing vmware-tools, you need to run vmware-toolbox in X and check the 'time sync' option (off by default.) I guess it basically does the same thing to change the config file.