How to get time synchronisation to work?

Discussions about using Linux guests in VirtualBox.
Post Reply
varboxer
Posts: 22
Joined: 29. Mar 2011, 12:29
Primary OS: Solaris
VBox Version: OSE other
Guest OSses: Solaris, Ubuntu

How to get time synchronisation to work?

Post by varboxer »

Hi

I've got a linux guest in a solaris host but the guest timekeeping is very poor.
NTP fails to keep the time synchronised so I'm trying the guest additions method.
However it doesn't seem to work, I've seen the offset go up to 20 minutes!
I've used commands like this on the host:
VBoxManage guestproperty set VM_NAME "/VirtualBox/GuestAdd/VBoxService/PARAMETER" VALUE
as documented but to no effect.
I've tried setting the parameters whilst the guest is off and whilst it is on, just in case.
Is there some trick I'm missing?
varboxer
Posts: 22
Joined: 29. Mar 2011, 12:29
Primary OS: Solaris
VBox Version: OSE other
Guest OSses: Solaris, Ubuntu

Re: How to get time synchronisation to work?

Post by varboxer »

Yes, guest additions are installed and the VBoxService process is running and has been restarted.

Since the time does seem to sync when it is 20 minutes out I suspect the settings are not taking effect. At what point are settings like "timesync-set-threshold" read and when can they be changed?

And why is the time offset getting worse and worse until it reaches 20 minutes rather than being kept better in sync?
ocean_xu
Posts: 3
Joined: 15. Mar 2012, 17:34

Re: How to get time synchronisation to work?

Post by ocean_xu »

what is ntpdate output?
varboxer
Posts: 22
Joined: 29. Mar 2011, 12:29
Primary OS: Solaris
VBox Version: OSE other
Guest OSses: Solaris, Ubuntu

Re: How to get time synchronisation to work?

Post by varboxer »

ntpdate takes several (~8) seconds to run. The delay is ~0.02588. The offset varies as I described, increasing non-monotonically up to 1200 seconds.
varboxer
Posts: 22
Joined: 29. Mar 2011, 12:29
Primary OS: Solaris
VBox Version: OSE other
Guest OSses: Solaris, Ubuntu

Re: How to get time synchronisation to work?

Post by varboxer »

I've changed the VM to simulate two CPUs instead of one and the time is now staying within 0.1 seconds.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: How to get time synchronisation to work?

Post by Ramshankar »

Do NOT run NTP client in parallel if you have the guest additions' time sync installed.
Oracle Corp.
varboxer
Posts: 22
Joined: 29. Mar 2011, 12:29
Primary OS: Solaris
VBox Version: OSE other
Guest OSses: Solaris, Ubuntu

Re: How to get time synchronisation to work?

Post by varboxer »

I'm still having big troubles with time sync. The guest time becomes wrong by more than 30 seconds.

Running VBoxService like this:

Code: Select all

VBoxService -v -v -f --enable-timesync --timesync-interval 1000 --timesync-set-threshold 1000 --timesync-set-start
I can see a couple of "timesync time set to" messages and a bunch of "timesync VBoxServiceTimeSyncAdjust: adjtime by" messages but only every two hours so the time still goes out too far too often.

Why is it only every two hours, how can it be synchronised more frequently?
hmartin
Posts: 1
Joined: 12. Sep 2012, 03:05

Re: How to get time synchronisation to work?

Post by hmartin »

Are you sure your options are being properly set? Can you post the results of running

Code: Select all

# VBoxService -vv
Post Reply