2

I have Ubuntu 13.10 set to use the time "automatically from the internet" (whatever that means). However it is running 3 minutes slower than the actual time.

How can I fix this permanently? I thought the point of getting time from a time server is that the machine would sync on a reasonably regular basis (perhaps once a minute, or even more frequently).

I have the ntp service installed already.

2 Answers 2

4

I found that ntpdate was the fix I was looking for.

Two steps:

1) Turn off automatic updates on the clock settings.

2) Use the command

sudo ntpdate ntp.ubuntu.com

According to Ubuntu, running ntp on a desktop (non-server) machine is not recommended.

https://help.ubuntu.com/10.04/serverguide/NTP.html

But also at that site, it outlines how to run ntpdate as a daily cron job

With your favorite editor, as root, create a file /etc/cron.daily/ntpdate containing:

ntpdate ntp.ubuntu.com

The file/etc/cron.daily/ntpdatemust also be executable.

sudo chmod 755 /etc/cron.daily/ntpdate

BTW, I still don't know what the "automatically from the internet" means either. As it very often fails, even when connected to the internet.

3
  • 2
    Hmm. I get the following response when I try ntpdate: 27 Jan 09:31:39 ntpdate[3512]: no server suitable for synchronization found. (As an aside, I also note that manually editing the time on my system doesn't work properly. If I change the time and close the dialog immediately, the changes aren't saved. I have to leave the dialog open for a minute or so for the change to propagate to the indicator, then it's safe to close the dialog.)
    – Roly
    Jan 27, 2014 at 9:39
  • The "No server suitable" error generally means either the ntp server is down or you have no internet connection. Try adding pool.ntp.org to the list of servers ntpdate ntp.ubuntu.com pool.ntp.org
    – Jim Parker
    Feb 19, 2014 at 12:06
  • I really like the idea of using the cron job to make sure that gets synced nightly or something. I have 14 ubuntu desktop instances running test cases and randomly one of them every now and then has the time 18 minutes off. weird behavior, but i will fix by putting this script in a cron: sudo ntpdate ntp.ubuntu.com Jun 13, 2014 at 1:22
1

You may need to install the ntp service instead. I've found that with it the clock the time may not be accurate all the time so it's better if using some kind of service to take care of this. You can install it just typing:

sudo apt-get install ntp

This will install a ntp server that will take care of the time synchronization. Disable the option in the time indicator and you are good to go.

4
  • I already have npt installed. Updated question to clarify. Thanks.
    – Roly
    Nov 2, 2013 at 8:42
  • Did you disable the "automatically from the internet" option and your hardware clock is accurate?
    – Braiam
    Nov 2, 2013 at 9:59
  • No, as stated in the original question. I'm guessing the problem is something to do with how often the system syncs with the time server.
    – Roly
    Nov 2, 2013 at 13:59
  • No, the problem is locally, no clock drift apart if there isn't a problem locally. You should check the /etc/adjtime file to find if the hardware clock correction are too high. It doesn't matter how many times you sync the clock if locally it will start to differ.
    – Braiam
    Nov 2, 2013 at 14:04

You must log in to answer this question.

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