Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The time in my guest VM is faster than the host time by about 20-30 minutes. What can can I do so that the time in the guest is the same as on the host?

share|improve this question

migrated from stackoverflow.com Aug 18 '12 at 2:16

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

For a Linux host, first install the DKMS (Dynamic Kernel Module Support) package on the guest machine (source):

$ sudo apt-get install dkms

Then install Guest Additions into guest system:

$ sudo apt-get install virtualbox-guest-additions

Also, here are descriptions of some commands to tune VirtualBox time synchronization.

share|improve this answer

The following setup allows my guest to reliably maintain a time that is accurate to within 1 second of my host. It is tested with VirtualBox 4.3.12.

First, on the host, configure time synchronization parameters for the guest by running the commands below. Replace <vmname> in the commands below with its appropriate value.

$ VBoxManage guestproperty set <vmname> "/VirtualBox/GuestAdd/VBoxService/--timesync-interval" 10000
$ VBoxManage guestproperty set <vmname> "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" 100
$ VBoxManage guestproperty set <vmname> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore" 1
$ VBoxManage guestproperty set <vmname> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000

I have restrained the values of the time parameters above to multiples of 10. You may at first be tempted to set timesync-set-threshold to 10000 instead, but this can risk a rather drastic time change when it's triggered, and may therefore break applications. If the value of <vmname> contains a space, it should of course be quoted.

Confirm the above configuration on the host:

$ VBoxManage guestproperty enumerate <vmname> | grep timesync | sort
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-interval, value: 10000, timestamp: 1402110397618554000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust, value: 100, timestamp: 1402110777505446000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore, value: 1, timestamp: 1402110904964050000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold, value: 1000, timestamp: 1402110660162295000, flags: 

Next, on the guest:

  1. Stop and disable all internal NTP and related timekeeping services. They should not be used as they are likely to interfere with VirtualBox.
  2. Restart the service named vboxadd-service. You will be having this installed assuming you've previously installed Guest Additions.
  3. If the time on the guest is not yet synced, but it should be, reboot the guest.

Reference: https://www.virtualbox.org/manual/ch09.html#changetimesync

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.