I am trying to manually set the computer's time in VirtualBox but it always resets itself to what it was before I changed it. How can I disable ntp and tell the system what time I want it to be?
I am trying to manually set the computer's time in VirtualBox but it always resets itself to what it was before I changed it. How can I disable ntp and tell the system what time I want it to be?
I have found a solution. Read the following material: link
Basically if you have Windows host and Ubuntu guest, do the following:
Ubuntu 12.04 32bit
C:\Program Files\Oracle
folder and clickVirtualBox
to select, then holding left shift key, do a mouse right-button click and select "Open command window here" menu, the interpreter has to be running nowPaste the following command (change the VM name to your name!):
VBoxManage setextradata "Ubuntu 12.04 32bit" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
Finally, start your Ubuntu guest and set the time and date manually.
Undo
If required, to get the guest to sync time with the host again, repeat the above steps but change the final
1
to0
.As mentioned in another answer, if you are running Ubuntu as a Guest under VirtualBox then you should be aware that the system time is automatically kept in sync by the Guest Additions (i.e., not through an option in the motherboard settings).
Your solution in that case is to disable the Guest Additions, which can be achieved by executing
or
You can then set the time as desired (from command line using
date --set
or using the system settings applet)The VirtualBox service will be restarted at next reboot, or you can do it manually.
The only way is to set the time in the Virtualbox motherboard using the command line:
For example, to set back the date 1 year:
Well, if you want to set arbitrary dates, first you should disable or deinstall ntp.
sudo update-rc.d -f ntp remove
After that you can use the
date
-command to set your system time:Both commands are equivalent. To only set the time you can use:
The
date
-manpage has some more format controls. You can use them all to change the dateClick on the time & date section of the panel, then the Calendar will appear and underneath that the Time & Date Settings is there so click that.
Click on the Padlock icon and enter your password, then choose Set The Time to manually.
In the Software Center look up ntpdate and remove it, or in terminal: sudo apt-get remove ntpdate
(You may have to reboot to fully disable ntp)
Then set your date.
Based on the ".ps1" (Windows PowerShell script) example given in
https://superuser.com/questions/539880/using-virtual-box-is-it-possible-to-set-your-virtual-machine-time-to-be-differen
I've written a regular ".bat" script file to change the clock time at which the VirtualBox's virtual machine starts.
The desired start time is set at variable "TEMPO_START_TIMESTAMP" in epoch format. You can get your desired start time epoh equivalent at "http://www.timestampconvert.com/".
The name of the VirtualBox's virtual machine to be started is needed in variable "NOME" (same nomenchature used in the ".ps1" script above).
You'll also need the current time in epoh format, for this use the following script (save as "toEpoch.vbs", this visual basic script is called from the ".bat" script above):
To run the virtual machine, simply execute the ".bat" script file above. No need to open the "Oracle VM VirtualBox Administration" interface.
I hope this helps.
Regards