How to change the date in VirtualBox and what to do when it returns [Development environment]

This is a note on how to change the system time in a local environment created with VirtualBox.
The time itself can be easily changed using the linux command date.
However, since VitualBox synchronizes the time with NTP (NetWork Time Protocol) server, the changed time will be restored immediately.
This section briefly explains how to deal with this problem.

How to disable time synchronization in VirtualBox when executing commands

// Stop time synchronization
service vboxadd-service stop 

// Change the time
date -s "2017/12/24 12:00:00"

// Resume time synchronization
service vboxadd-service start


How to disable time synchronization on VM startup

Execute the following command.

VBoxManage setextradata "VM name" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1

Run it with the VirtualBox installation folder as the current directory. Or run VBoxManage.exe by specifying the path.
By changing the “1” at the end of the word back to “0”, you can restart the synchronization. Since this is at boot time, you will need to reboot the VM.

This is a brief explanation of how to change the date in VirtualBox, and what to do if it reverts back to the original date.

Leave a Reply 0

Your email address will not be published.

one × 1 =