Linux – ntpd on Ubuntu fails to sync with status 2040

linuxntpUbuntu

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

Best Answer

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.