Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 193.79.237.14    2 u   45   64    1    2.047    0.091   0.001
*ns1.bvc-cloud.d 160.45.10.8      2 u   28   64    1   17.228    0.133   0.149
 lswb-nl-81.serv 193.79.237.14    2 u   27   64    1   11.976   -2.968   0.053
 ns208372.ovh.ne 213.186.33.99    3 u   26   64    1    8.021   -0.859   0.100
 melli.adop.de   40.179.132.91    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?

Update

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
share|improve this question
    
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
add comment

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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