16

I'm running a Ubuntu VM with VirtualBox and I have both the dkms and virtualbox-guest-additions packages installed. I read in this answer that the system clock should sync with the host automatically with the Guest Additions, but mine doesn't seem to be doing that. What are some possible reasons / how do I rectify this? I've tried searching for this all over but most of the hits I get off Google tell you how to disable the automatic time sync, not enable it.

My host machine is running OS X 10.8, if that's of any help.

2
  • 1
    What version of Ubuntu and what version of Virtualbox are you using? One would think the tutorial on how to disable could be used to enabled it by changing a single step. Can you link to one such guide?
    – Ramhound
    Commented Sep 24, 2013 at 13:33
  • I'm using Ubuntu 12.04 and VirtualBox 4.2.18. I initially followed this small post to install Guest Additions. I know what you mean, my suspicion is also that the answer is very simple, but I can't seem to find it anywhere. Commented Sep 24, 2013 at 13:49

2 Answers 2

22

Turns out I needed to install the ntp package, in addition to the two others I mentioned above.

The date/time after I woke my computer up from sleep:

$ date
Wed Sep 25 12:50:25 EDT 2013

Then, to correct it:

$ sudo service ntp stop
 * Stopping NTP server ntpd                          
$ sudo ntpdate pool.ntp.org
25 Sep 13:22:45 ntpdate[15379]: step time server 109.169.89.48 offset 1880.691920 sec
$ sudo service ntp start
[sudo] password for yiqing: 
 * Starting NTP server ntpd  

Now synced to the real date/time:

$ date
Wed Sep 25 13:23:07 EDT 2013

Once I rebooted, I found that my VM's system clock synced to my host as desired.

1
  • 7
    "I found that my VM's system clock synced to my host as desired" Not to your host but to an external NTP server - there is a big difference, this approach requires network connectivity for the guest system whereas VirtualBox tools can accomplish actual time sync from host system without network connectivity.
    – geekuality
    Commented Jun 9, 2015 at 13:32
1

Assuming virtualbox-guest-additions is installed, if time-sync with the host is not working, you can enable it with:

Commands to be run from the Host

# Synchronize the time with the host every 60 seconds (Default 10 seconds)
VBoxManage guestproperty set "${VB_VM_NAME}" "/VirtualBox/GuestAdd/VBoxService/--timesync-interval" 60000
# Adjust in drift increments of 1 second (Default 100 milliseconds)
VBoxManage guestproperty set "${VB_VM_NAME}" "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" 1000
# Adjust if out of sync by more than 30 seconds (Default 20 minutes!)
VBoxManage guestproperty set "${VB_VM_NAME}" "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 30000

Info comes from https://forums.virtualbox.org/viewtopic.php?t=90233

This is a much better solution than using NTP, because whenever the VM or the Host resume from suspend/pause/hibernate, the time-sync would happen right away.

I'd live very much to know why wouldn't it (time-sync with host) be working if the guest-additions are installed and running (happened to me as well). Please comment if you have a clue/pointer.

You must log in to answer this question.

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