Time sync doesn't automatically work (anymore?)

Discussions about using Windows guests in VirtualBox.
Post Reply
Pete S
Posts: 3
Joined: 11. Feb 2011, 21:44
Primary OS: Debian Lenny
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows linux freebsd

Time sync doesn't automatically work (anymore?)

Post by Pete S »

I'm pretty sure my windows VMs would keep the same time as the host (debian).
But not anymore.
A few months ago I upgraded from 3.2.8 to 3.2.10 on the host. And installed newer guest additions on one virtual XP but not on others. No VM keeps the same time as the host.

Did some default setting change between versions? And how can I keep the guests time the same as the host?

Any advice would be most appreciated!

Thanks,
Pete
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Time sync doesn't automatically work (anymore?)

Post by Perryg »

Time sync is included in the guest additions so if they are not installed or out of sync that could cause your problem.
Pete S
Posts: 3
Joined: 11. Feb 2011, 21:44
Primary OS: Debian Lenny
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows linux freebsd

Re: Time sync doesn't automatically work (anymore?)

Post by Pete S »

Thanks Perryg,

Guest additions are installed. One VM has the same as the server 3.2.10 and the others have 3.2.8.

But right now when I look again they are in sync.

What could make the time drift in and out when the guest additions are installed?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Time sync doesn't automatically work (anymore?)

Post by Perryg »

Several things. Like pause, or save state. The recoup time if the guest has been paused or saved is around 20 minutes. Anything less and it can take a long time to adjust. You can change this but until I know more I can not tell you how.
Pete S
Posts: 3
Joined: 11. Feb 2011, 21:44
Primary OS: Debian Lenny
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows linux freebsd

Re: Time sync doesn't automatically work (anymore?)

Post by Pete S »

I have the guests running 24/7. The host is headless and its syncs time to a stratum 1 time server so the time on the host is very precise, less than 50 microseconds or so. The host doesn't go into standby or sleep or anything like that. And I don't stop or pause the guests either.

When I don't do any actual work in the guests the clocks will lag maybe fifteen to twenty minutes. Then when I start working again the clocks will speed up exactly 50% until the right time is reached then it starts to overcompensate so the guest is ahead in time then lags behind then ahead again then lags behind. After about two hours the guest time stays within +/- 5 seconds compared to the host.

I use either the remote desktop in the OS on the XP and W2003 servers or the embedded remote desktop and I keep the windows open 24/7 on my workstation.

As I mentioned above the host time is always dead on. I don't know the inner workings of the VMs but why can't the guest just have the exact time as the host even without guest additions?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Time sync doesn't automatically work (anymore?)

Post by Perryg »

The time-sync between the host and the guest are in the guest additions, so that answers that. Time shifts are normally caused by kernel timing issues.
What you can do is test a few things on the guest.
Open the guests terminal window (Linux) or command Window (Windows) and as elevated user (su/sudo, admin)
type VBoxService --help
Look at the part pertaining to time. Polling, intervals, Etc.. and you can adjust them from the guest. (lost on reboot)
When you find what you need then on the host use VBoxManage to add the command to the machine XML file so it runs on reboot.

Example: I had a issue of pausing the guest for less then 20 minutes and the time to recoup taking hours if not days to correct itself. I ran the following to find what I needed in a Linux guest.

Code: Select all

As su/sudo on guest to test
VBoxService --timesync-set-threshold 1000

Or run this on the host to make permanent 
VBoxManage guestproperty set Ubuntu-10.04 "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
Post Reply