Time drifts in Virtual machines (with guest additions)

Discussions about using Linux guests in VirtualBox.
Post Reply
wild_oscar
Posts: 2
Joined: 15. Jun 2011, 13:31
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: ubuntu linux

Time drifts in Virtual machines (with guest additions)

Post by wild_oscar »

Hi have the following set-up:
- Linux Host (ubuntu server) 4.2.6
- 3 Linux VMs (ubuntu server)

My 3 virtual machines cannot maintain the date synchronized with the host and always seem to time drift. I tried the following:

1. NTPD
2. NTP running on cron every 5 minutes (as ntpd couldn't keep up with the time drift).

A couple of days ago NTP cron was yielding time jumps of over 5 seconds regularly, so I decided to try the Guest additions (VBoxService --version is 4.2.6r82870).

I followed the user's manual - http://www.virtualbox.org/manual/ch04.html#idp12039536, but I'm having some issues:

1. I have set the following properties:
VBoxManage guestproperty set "webservices" "/VirtualBox/GuestAdd/VBoxService/--timesync-interval" 10000
VBoxManage guestproperty set "webservices" "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" 100
VBoxManage guestproperty set "webservices" "/VirtualBox/GuestAdd/VBoxService/--enable-timesync"
Q1: I find it odd that without setting them, if I "get" the property it'll say it is not defined. Shouldn't it output the default value?

2. Even though the service is running (see below), there is a time drift (a time drift of 10 minutes or more will exist after 12 hours!)
~$ sudo service vboxadd-service status
Checking for VBoxService ...running
~$ ps aux | grep VBox*
root 2331 0.1 0.0 19860 1280 ? Sl 14:51 0:00 /usr/sbin/VBoxService
Q2: Where are the settings for the daemon defined (and, e.g., the log file)? How can I investigate why the time isn't being adjusted properly?

3. I have also tried stopping the daemon and running the command on foreground: sudo VBoxService --enable-timesync --timesync-interval 5000 --foreground --verbose, but I have an additional error I don't understand. Log will be print in entry pairs:
00:01:30.011626 timesync VBoxServiceTimeSyncAdjust: adjtime by -4 412 264 000 ns
00:01:30.349557 vminfo Error: ConsoleKit: unable to retrieve user for session '/org/freedesktop/ConsoleKit/Session4' (msg type=1): No error information available
Q3: What is this ConsoleKit error and how can I fix this?

Thank you for any help!
klaus
Oracle Corporation
Posts: 1115
Joined: 10. May 2007, 14:57

Re: Time drifts in Virtual machines (with guest additions)

Post by klaus »

This might be a case of super picky software and the fact that you're taking online snapshots. While an online snapshot is taken the VM is paused, and while a VM is paused its time isn't ticking. That means its time will be behind when it is resumed, and the time synchronization service included in the guest additions will take care of adjusting the clock to the host time. This is done very gradually (speeding up time slightly), as taking a snapshot will need between a few seconds and maybe a minute (depending on the hard disk speed of the host and the size of the VM memory mainly). Only if time is off by 20 minutes then step adjustments are done.
sergiomb
Posts: 21
Joined: 1. Dec 2011, 03:11
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: windows Fedora rawhide

Re: Time drifts in Virtual machines (with guest additions)

Post by sergiomb »

wild_oscar wrote:Hi have the following set-up:
00:01:30.011626 timesync VBoxServiceTimeSyncAdjust: adjtime by -4 412 264 000 ns
00:01:30.349557 vminfo Error: ConsoleKit: unable to retrieve user for session '/org/freedesktop/ConsoleKit/Session4' (msg type=1): No error information available
Q3: What is this ConsoleKit error and how can I fix this?
I also got "ConsoleKit: unable to retrieve user for session" with Fedora 21 / rawhide
I systemctl reload dbus and restart console-kit-daemon and seems the message is gone

systemctl status console-kit-daemon.service
Post Reply