Guest time sync with host

Discussions related to using VirtualBox on Windows hosts.
Post Reply
PP
Posts: 3
Joined: 9. Nov 2018, 11:21

Guest time sync with host

Post 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
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Guest time sync with host

Post 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.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
PP
Posts: 3
Joined: 9. Nov 2018, 11:21

Re: Guest time sync with host

Post by PP »

Hi,
I didn't mess with time... VM is inherited from another user. :-)
Thanks for swift reply!
//Per
Attachments
MFGDEV_Environment.zip
(2.38 KiB) Downloaded 160 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Guest time sync with host

Post 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.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
PP
Posts: 3
Joined: 9. Nov 2018, 11:21

Re: Guest time sync with host

Post 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.
fdavis
Posts: 1
Joined: 1. Feb 2019, 18:45

Re: Guest time sync with host

Post by fdavis »

Did you find a solution?
Smackey's dad
Posts: 126
Joined: 2. Apr 2014, 04:11
Primary OS: Ubuntu 12.04
VBox Version: OSE Debian
Guest OSses: Ubuntu Trusty
Location: Austin, TX
Contact:

Re: Guest time sync with host

Post 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.
Post Reply