Hello, I have a Ubuntu 10.04 server running on a VM on Windows XP, and would like to sync the VM's date/time with the XP one. How can I do this?

I tried with the date -s command in the console, but after some time the date/time on the VM is running too far ahead.

Dani AI

Generated

Short summary and practical next steps (for a prebuilt Ubuntu 10.04 guest running in VMware Workstation 8):

You’re seeing classic VM clock drift. As notes, manually setting the clock or just reconfiguring the timezone won’t stop the guest from gradually running ahead. was right that the guest can use the virtual “hardware” clock, but the reliable fixes are to either (A) use the virtualization tools’ host-sync feature or (B) run a proper network time daemon — not both at once.

Recommended steps

  1. If the host (Windows XP) should be the authority: install VMware Tools (or open-vm-tools inside the Ubuntu guest) and enable the “synchronize guest time with host” option in Workstation. This keeps the VM tied to the host clock and is the simplest cure when the guest has no reliable Internet time source.

  2. If the guest has Internet access and should keep true time independently: install an NTP client (ntp or chrony) and let it peer with public NTP servers. Disable VMware time sync so the two services don’t fight and oscillate.

Quick install example to do both packages on a server guest:

sudo apt-get update
sudo apt-get install open-vm-tools ntp

Troubleshooting tips

  • Check which process is making adjustments (vmtoolsd vs ntpd) by watching syslog for frequent “time set” messages.
  • Match the guest’s RTC setting to the host (Windows commonly uses localtime), otherwise the guest may apply wrong offsets on boot or DST changes.
  • If drift persists under VMware, consider switching the kernel clocksource (VMs sometimes have unstable TSC); that’s an advanced tweak but often fixes steady drift.

Bottom line: pick one sync method (Tools → host sync OR guest NTP), confirm VMware Tools is installed for host-sync, and verify the guest’s RTC mode matches the Windows host.

Recommended Answers

All 2 Replies

When you installed the system, you were able to tell it to sync to the hardware clock, which in the case of a virtual machine, would be the host clock. You can still do that via the System->Preferences menu.

In fact the VM was a pre-built one, I just extracted it and opened with VMWare Workstation 8. It is a server version, so I don't think it has the System -> Preferences displayed as such. I did try set the date and time again using dpkg-reconfigure tzdata, as well as date -s command, but it still after some time start running ahead of the physical host time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.