Page 1 of 1

Guest time sync with host

Posted: 9. Nov 2018, 11:28
by PP
Hi all,
I'm pretty new to Virtualbox and right now I'm trying to get time synchronization to work from host to guest. I'm running a Windows7 VM on a Win10 host. Time synchronization is not working. I have tried using vboxmanage "vm" vboxinternal/devices/vmmdev/0/config/gethosttimedisabled 0, however, when I start up the VM time sync is not working, i.e. in my case guest time is one year behind host time. Simultaneously (when the VM is starting) the vm.vbox is modified where "gethosttimedisabled" is reset to "1".
Anyone have any great ideas why gethosttimedisabled 0 is not preserved?

Regards,
Per

Re: Guest time sync with host

Posted: 9. Nov 2018, 11:39
by socratis
  1. Do not mess with time. Why did you start messing with it? I've never had a guest that needed manual "massaging" of its time. And I have plenty of guests...
  2. Right-click on the VM in the VirtualBox Manager. Select "Show in Finder/Explorer/Whatever". ZIP the selected ".vbox" file and attach it to your response.

Re: Guest time sync with host

Posted: 9. Nov 2018, 11:55
by PP
Hi,
I didn't mess with time... VM is inherited from another user. :-)
Thanks for swift reply!
//Per

Re: Guest time sync with host

Posted: 9. Nov 2018, 17:37
by socratis
  1. Quit VirtualBox and wait for 1 minute, or even better, restart your host computer.
  2. Make a backup of the .vbox file, in case you mess it up.
  3. Open the .vbox file with a file editor that can understand all different line endings. I would suggest Notepad++.
  4. Delete lines 28, 29 and 30, save and close the .vbox file:
    <ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
    <ExtraDataItem name="ôVBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabledö" value="ô1ö"/>
    <ExtraDataItem name="“VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled”" value="“1”"/>
  5. Start VirtualBox, start your VM, go to the Time settings and set the time. If the time is way off, things might get crazy.

Re: Guest time sync with host

Posted: 12. Nov 2018, 17:25
by PP
Hi,
I've tried this before, i.e. removed the three lines from .vbox. However, as soon as I start up VM the values are written back to .vbox file.

One more thing that I notice is that if I manually try and set date and time the "Apply" button is greyed out. If I click Ok the date and time changes, but only for a few seconds - then they switch back to the original values.
*EDIT*
Another thing, if I disable VirtualBox Guest Additions and then set date and time it works! However, when I start the VirtualBox Guest Additions service again the date and time are changed to an incorrect value.

Re: Guest time sync with host

Posted: 1. Feb 2019, 18:54
by fdavis
Did you find a solution?

Re: Guest time sync with host

Posted: 26. Jan 2020, 02:49
by Smackey's dad
You cannot update the dot vbox file directly for a registered VM. It is best practice not to and to use the VBoxManage commands. But in case you want to, then unregister the VM first, update and re-register. On all my VMs I use the standard time sync settings below:

Code: Select all

# 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
If this is a Ubuntu VM also do the below once. I know this is for Windows VM, but you will have to figure out the equivalent.

Code: Select all

date --set "25 Jan 2020 10:21 AM"
hwclock -w
Of course you will have to make sure the Guest Additions is working correctly. Run these commands on guest to validate: (again, unsure how this is to be done in Windows - perhaps it's a service?)

Code: Select all

lsmod | grep -i vboxguest
modinfo vboxguest
And lastly make sure extension packs (of preferably the same version of the guest additions) are installed on the host.

Code: Select all

VBoxManage list extpacks
I realized that my post is backwards - check host extpacks first, then VM guest additions, set the guest property and lastly set the hwclock / date on guest.