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?

  • Can you give some more details about your problem? Whattime do you want it to be and what time sets your computer?
    – qbi
    Apr 17, 2011 at 7:05
  • 6
    I want to set an arbitrary wrong time on my computer. Apr 17, 2011 at 7:11

7 Answers 7


I have found a solution. Read the following material: link

Basically if you have Windows host and Ubuntu guest, do the following:

  1. Find a name of your VM (Virtual Machine) - run VB (VirtualBox), select your VM, open settings, in 'General' tab check the name, e.g. in my case Ubuntu 12.04 32bit
  2. In Windows, start a command line interpreter, go to C:\Program Files\Oracle folder and click VirtualBox 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 now
  3. Paste the following command (change the VM name to your name!):

    VBoxManage setextradata "Ubuntu 12.04 32bit" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1

  4. Finally, start your Ubuntu guest and set the time and date manually.


If required, to get the guest to sync time with the host again, repeat the above steps but change the final 1 to 0.

  • 7
    this should definitely be the accepted answer! i didn't want to disable guest additions as i have a shared folder mounted in my ubuntu server 14 guest
    – Jon B
    Feb 5, 2015 at 23:11
  • Unfortunately, it does not "freeze" the time on the guest system. In some scenarios though you want to completely freeze all time (like for doing reproducible builds). Dec 6, 2015 at 20:06
  • this just saved me a lot of time
    – elsadek
    May 2, 2016 at 12:14
  • If your host OS is Ubuntu, the command is: vboxmanage setextradata "your_VM_name_here" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
    – Radu Maris
    Mar 3, 2017 at 8:45
  • See this question, it worked when I tried it: stackoverflow.com/a/45724822/18149 The vboxadd-service needed an extra argument on the guest, mainly --disable-timesync
    – leeand00
    Aug 18, 2017 at 1:55

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

sudo service vboxadd-service stop


sudo /etc/init.d/vboxadd-service stop

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.

  • 3
    Off topic, but disabling/uninstalling Guest Additions allows you to set the system clock on Windows guest OSes as well Feb 18, 2014 at 21:14
  • 3
    In my version of Ubuntu the command was sudo service virtualbox-guest-utils stop. I guess the package was renamed? Mar 30, 2015 at 17:24
  • @Crashthatch your solution is the only one which works. thanks.
    – Bevor
    Dec 13, 2018 at 12:35

The only way is to set the time in the Virtualbox motherboard using the command line:

VBoxManage modifyvm <name> --biossystemtimeoffset <msec>

For example, to set back the date 1 year:

VBoxManage modifyvm <name> --biossystemtimeoffset -31536000000

Well, if you want to set arbitrary dates, first you should disable or deinstall ntp.

  • To disable it, open a terminal and run sudo update-rc.d -f ntp remove
  • To deinstall it, use your favorite software management software

After that you can use the date-command to set your system time:

date -s "17 April 2011 12:34:56"
date --set="17 April 2011 12:34:56"

Both commands are equivalent. To only set the time you can use:

date +%T -s "12:34:56" 

The date-manpage has some more format controls. You can use them all to change the date

  • Ok, I've done that but sudo date -s only holds the date for a few seconds before reverting. By that, I mean, running date again shows the time I set working normally but the time indicator in the panel does not, and when I run date again, the time has switched to match the panel clock.....And trying to change the indicator-datetime clock doesn't work either. I think I'm going to have to open a bug. Apr 17, 2011 at 18:23
  • Are you sure that deinstalled/disabled ntp? Do you some other automatic time management software (i.e. chrony) installed?
    – qbi
    Apr 20, 2011 at 19:33
  • It's a new Natty install in VirtualBox and I purged anything ntp and did not install any other time management software. Apr 21, 2011 at 0:40
  • 2
    Virtualbox „transfers“ the time from your host to the client. You'll have to change some options here. Maybe virtualbox.org/manual/ch03.html#settings-motherboard is helpful.
    – qbi
    Apr 21, 2011 at 22:40

Click 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.

  • I'm going to go ahead and mark this as the best answer for most users. My specific problem was with VirtualBox. Apr 24, 2011 at 6:34

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.

  • Ok, I purged ntpdate and rebooted but I'm still unable to set the system clock and have it stick. Apr 17, 2011 at 7:12

Based on the ".ps1" (Windows PowerShell script) example given in


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).

echo off
echo %time%

set NOME="Windows_7_x64"

set TEMPO_CS_2_MS=0
set TEMPO_S_2_MS=000

rem # Starts the VM always on the date 07/11/2014 - 11h58
rem http://www.timestampconvert.com/

set   TEMPO_START_TIMESTAMP=1415361480

for /f "delims=" %%x in ('cscript /nologo toEpoch.vbs') do set epoch=%%x
rem %epoch%

rem set TEMPO_CURRENT_TIMESTAMP=1544518714


rem %TEMPO%

c:\Progra~1\Oracle\VirtualBox\VBoxManage setextradata %NOME% "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
c:\Progra~1\Oracle\VirtualBox\VBoxManage modifyvm %NOME% --biossystemtimeoffset %TEMPO%
c:\Progra~1\Oracle\VirtualBox\VBoxManage startvm %NOME%

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):

WScript.Echo DateDiff("s", "01/01/1970 00:00:00", Now())

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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .