3

I have a desktop (centos 6) that has a VM guest (RedHat 5.5).

I just try to set the date to past time in VM guest. And it works.

However, after 50 minutes, the time is sync to current time.

After I check with the cron job, I did not find any cron job to do the time sync.

May I know how can I disable the time sync in the VM guest?

Edited: I am using virsh to start and stop VM guest.

4
  • Are you using KVM? or something else?
    – Braiam
    Aug 13, 2014 at 22:28
  • Which VM technology are you using? KVM? VMware? LXC? VirtualBox? OpenVZ? Xen? … Aug 13, 2014 at 22:29
  • I think virtual machines have an emulated hardware clock, which is basically proxying to the real hardware clock. Not sure if it is possible for them to be out of sync with the host machine
    – pqnet
    Aug 13, 2014 at 22:31
  • See this article: rogierm.redbee.nl/blog/2011/11/07/…
    – slm
    Aug 14, 2014 at 0:00

4 Answers 4

2

If you are running VM tools, the tool has an option to periodically sync the time with the host.

If in your path: vmware-toolbox-cmd timesync status to view and vmware-toolbox-cmd timesync disable to stop it.

Of course any non-vm method of time sync could be there as well. If the system starts ntpd, it may be syncing that way. You could run ntpd -q to see if the system responds with associations. If so, it will probably sync with them. You'd then want to disable ntpd.

3
  • I am using virsh to start and stop VM guest. Is the command above still valid?
    – michael
    Aug 13, 2014 at 8:48
  • Doesn't matter how it's started. Just matters if it is a vmware guest and if vmware tools have been installed (and are running) inside the guest.
    – BowlOfRed
    Aug 13, 2014 at 8:50
  • @michael, I thought your question was specific to VM, but realize you could just be asking about general sync. Added NTP check to the answer.
    – BowlOfRed
    Aug 13, 2014 at 8:52
2

It is possible that some NTP service is still running on your system.

Try

chkconfig --list ntpdate

and

chkconfig --list ntpd

It is also possible that ntpdate is called after some other event. You can try to uninstall NTP (ntpdate, ntpd) from the guest machine to disable it completely.

2

This is on ESX so may not apply. Using vSphere Client:

Click on VM > Edit Settigns > Options Tab > VMware Tools

In the right on the bottom it could be possible that in the Advanced block the Synchronize guest time with host setting is checked. Uncheck this setting.

This bothered me a long time because I thought the OS on the VM kept syncing and I couldn't figure it out. It turned out that this was outside the host and was being done by ESX.

1

The guest may continue to sync time when certain actions like snapshots are taken/removed - regardless if you disable it in the vmtools client. You can disable it fully in the VMX file. See this KB:

https://kb.vmware.com/kb/1189

1
  • This is the only one working for me. In addition to this, I need to stop NTP service in my guest OS (CentoOS) using systemctl stop chronyd to avoid sync with the network time.
    – VSB
    Jan 12, 2021 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .