5

I am setting up a development environment with Ubuntu in a virtual machine. The date in the VM must be in 2009 due to some silly timebombing issues, so I want to disable any automatic time synchronization (e.g. ntpdate).

$ sudo apt-get remove ntpdate
...
The following packages will be REMOVED:
ntpdate ubuntu-minimal

Obviously, I don't want to remove ubuntu-minimal. Unfortunately, the machine keeps resetting the time forwards every couple of seconds. How do I disable this or stub out this feature?

6

Are you sure ntpdate is your problem? It does not run as a service and usually only gets run when an interfaces is brought up on recent ubuntu systems.

To disable ntpdate on an Ubuntu system without removing it you could simply update /etc/default/ntpdate and add the word exit as the first line or change the NTPSERVERS variable to be empty.

Are you sure the issue isn't related to your VM tools package? Are you sure you haven't actually installed a full ntp daemon?

Intentionally keeping time out of sync in a single VM can be somewhat difficult. The system clock is one of the resources that don't really get virtualized very well.

  • So you're right: ntpdate is probably not my problem, because I just tried your suggestion (editing the NTPSERVERS variable to be empty) and the date is still resetting. How can I find this thing? – Andres Jaan Tack Jan 19 '10 at 18:52
  • 1
    Aha! I disabled time synchronization in VMWare (set tools.timeSync = "0" in the .vmx file) and my problems are solved! Thanks for pointing me in the right direction! – Andres Jaan Tack Jan 19 '10 at 19:03
  • For Oracle Linux (and probably any Red Hat Linux flavour) you have to modify the file /etc/ntp.conf and comment the existing NTP servers. – Mike Argyriou Feb 18 '16 at 14:55
4

ubuntu-minimal is the package which provides many other packages in the Ubuntu minimal install. Removing that package does not cause any problems. Later on if you want to get all the packages in a minimal installation then just reinstall ubuntu-minimal.

0

I have a ubuntu/trusty64 virtual machine I built with vagrant. I had to turn off the time sync in the virtualbox guest addition on the virtual machine. To do this I added VBOX_OPTS to /etc/init.d/virtualbox-guest-utils like so:

edit /etc/init.d/virtualbox-guest-utils insert these lines:

if [ -n "$2" ]; then
VBOX_OPTS="$VBOX_OPTS $2"
fi

modify this line:

start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/VBoxService -- $VBOX_OPTS

Now stop and start the service like so

sudo service virtualbox-guest-utils stop
sudo service virtualbox-guest-utils start --disable-timesync

Now I can set the date to what I need and it stays that way until I reboot the machine.

date -s "2014-02-22 22:41:49,332" && date --rfc-3339=ns
date
Sat Feb 22 23:27:31 EST 2014
-1

man update-rc.d

The correct way to disable services is to configure the service as stopped in all runlevels in which it is started by default. In the System V init system this means renaming the service’s symbolic links from S to K.

sudo update-rc.d ntp stop 20 2 3 4 5 .

or put an exit inside:/etc/default/ntp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.