My Ubuntu 10.04 server has ntpd running with default configuration.

Problem is it doesn't sync. Syslog shows:

 kernel time sync status 2040

When I try stopping ntpd and running ntpd -q it does work.

So I'm guessing the difference lies in the way ntpd is configured to run as a service.

This is how ntpd is running as a service:

/usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104

Other things I've tried is running ntpdate, which worked, but afterwards restarting ntpd again fails to sync. Also tried adding more servers, which didn't help:

ntpq -p shows:

     remote           refid      st t when poll reach   delay   offset  jitter
 europium.canoni    2 u   45   64    1    2.047    0.091   0.001
*ns1.bvc-cloud.d      2 u   28   64    1   17.228    0.133   0.149
 lswb-nl-81.serv    2 u   27   64    1   11.976   -2.968   0.053
 ns208372.ovh.ne    3 u   26   64    1    8.021   -0.859   0.100
 melli.adop.de    2 u   25   64    1   17.049    1.430   0.163

How can I tell why ntpd is failing to sync when running as a daemon as opposed to when running with -q?


Inside ntp.conf I have the following servers:

server ntp.ubuntu.com
server pool.ntp.org 

I also tried adding:

server 0.fedora.pool.ntp.org iburst
server 1.fedora.pool.ntp.org iburst
server 2.fedora.pool.ntp.org iburst
server 3.fedora.pool.ntp.org iburst
  • Are you running VMware? – quanta Sep 13 '12 at 9:52
  • 1
    Running on Linode: linode.com – Assaf Lavie Sep 13 '12 at 9:57
  • How about tracing the source with something like sudo strace -e trace=network ntpd -n, also what is your grep ^server /etc/ntp.conf – Evgeny Sep 13 '12 at 10:21
  • I've updated the server list above. Not sure what to make of the strace output. As I said, ntpd from command line works - just not when run as a service. – Assaf Lavie Sep 13 '12 at 10:40
  • 1
    Are you using a XEN kernel having automatic synchronization ? Does /proc/sys/xen exist ? – Knight Samar Sep 13 '12 at 19:57

Turns out that simply restarting the NTP service doesn't in fact try to sync the clock. That error message is still unclear to me, but nevertheless about 15 minutes after restarting the service the clock is synced properly.

| improve this answer | |

ntpd won't immediately slam the correct time into the OS clock since that can cause errors to software that use clock, it gently adds corrections over time. Note also that if your system clock is too far off ( by default that's 1000 seconds) ntpd will put message to that effect in the log and fail to start

| improve this answer | |

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.