ntpd doesn't work - time is not synchronized

Bug #238805 reported by LimCore
18
Affects Status Importance Assigned to Milestone
ntp (Ubuntu)
Invalid
Low
Unassigned

Bug Description

When I run ntpd, then my clock is NOT synchronized at all, my clock drifts and after few days is 10 minutes off from pool.ntp.org

When I run by hand: ntpdate pool.ntp.org then time corrects itself.

up-to-date ubuntu 8.04 amd64
ii ntp 1:4.2.4p4+dfsg-3ubuntu2
ii ntpdate 1:4.2.4p4+dfsg-3ubuntu2

root@limcore:~# date
Tue Jun 10 10:52:42 CEST 2008

(after a minute of tests)

root@limcore:~# ntpdate pool.ntp.org
10 Jun 10:53:26 ntpdate[6197]: the NTP socket is in use, exiting
root@limcore:~# /etc/init.d/ntp stop
 * Stopping NTP server ntpd [ OK ]
root@limcore:~# ntpdate pool.ntp.org
10 Jun 11:04:01 ntpdate[6217]: step time server 193.0.71.133 offset 617.900782 sec

Revision history for this message
LimCore (limcore) wrote :

To clarify:

1. yes, ntpd was running (ps aux....)
2. yes, the time drifts slowly away from real tim
3. yes, I have ntp servers configured (the default) /etc/ntp.conf
server ntp.ubuntu.com
server pool.ntp.org
4. no, I dont have no strange special settings or nothing like that
5. I was testing it for some time now, and when ever I leave ntpd running - then time slowly drifts away, and whenever I use ntpdate pool.ntp.org the time is correct (but I want to use ntpd not ntpdate beacuse ntpd can apply the corrections more precisely - https://help.ubuntu.com/8.04/serverguide/C/NTP.html)

Revision history for this message
LimCore (limcore) wrote :

Perhaps it is a problem with adjtime() ?

also ntpdate also fails to synchronize the time if offset if less then 0.5 second - so when it uses adjtime()
but works fine for biggest drifts, when settimeofday() is used (according to man ntpdate)

perhaps ntpd tries to use adjtime() and thats why it doesnt work?

Notice how only >0.5 sec drifts are fixed and smaller remain unfixed by ntpdate also:

root@limcore:~# /etc/init.d/ntp stop ; while true ; do ntpdate pl.pool.ntp.org ; sleep 20 ; done
 * Stopping NTP server ntpd [ OK ]
10 Jun 11:59:55 ntpdate[6667]: adjust time server 217.153.128.243 offset 0.165079 sec
10 Jun 12:00:19 ntpdate[6669]: adjust time server 217.153.128.243 offset 0.205100 sec
10 Jun 12:00:44 ntpdate[6671]: adjust time server 83.19.137.3 offset 0.250410 sec
10 Jun 12:01:08 ntpdate[6674]: adjust time server 217.153.128.243 offset 0.298344 sec
10 Jun 12:01:33 ntpdate[6676]: adjust time server 83.19.137.3 offset 0.344156 sec
10 Jun 12:01:54 ntpdate[6681]: adjust time server 83.19.137.3 offset 0.389814 sec
10 Jun 12:02:14 ntpdate[6683]: adjust time server 83.19.137.3 offset 0.430025 sec
10 Jun 12:02:39 ntpdate[6685]: adjust time server 217.153.128.243 offset 0.471731 sec
10 Jun 12:03:04 ntpdate[6688]: step time server 217.153.128.243 offset 0.518811 sec
10 Jun 12:03:25 ntpdate[6690]: adjust time server 83.19.137.3 offset 0.055616 sec
10 Jun 12:03:49 ntpdate[6693]: adjust time server 217.153.128.243 offset 0.097457 sec
10 Jun 12:04:14 ntpdate[6695]: adjust time server 83.19.137.3 offset 0.142246 sec
10 Jun 12:04:39 ntpdate[6697]: adjust time server 83.19.137.3 offset 0.190079 sec
10 Jun 12:05:03 ntpdate[6710]: adjust time server 217.153.128.243 offset 0.239657 sec
10 Jun 12:05:28 ntpdate[6713]: adjust time server 217.153.128.243 offset 0.286784 sec
10 Jun 12:05:52 ntpdate[6715]: adjust time server 217.153.128.243 offset 0.333004 sec
10 Jun 12:06:17 ntpdate[6717]: adjust time server 217.153.128.243 offset 0.379739 sec
10 Jun 12:06:47 ntpdate[6719]: adjust time server 217.153.128.243 offset 0.437479 sec
10 Jun 12:07:11 ntpdate[6725]: adjust time server 217.153.128.243 offset 0.484347 sec
10 Jun 12:07:36 ntpdate[6727]: step time server 217.153.128.243 offset 0.531317 sec

Revision history for this message
Forest (foresto) wrote :

What is the output of ntpq -p ?

Revision history for this message
LimCore (limcore) wrote :

I started again ntp (because I disabled it to run ntpdate by hand just now) and then the output is:

after minute or so

root@limcore:~# ntpq -p
     remote refid st t when poll reach delay offset jitter
==============================================================================
 barbara6893.net 212.244.36.227 2 u 20 64 1 31.870 40552.5 0.001

and after a bit later

     remote refid st t when poll reach delay offset jitter
==============================================================================
 barbara6893.net 212.244.36.227 2 u 66 64 1 31.870 40552.5 0.001

Revision history for this message
Phil Sumner (pmsumner) wrote :

I believe this is a duplicate of ticket #104091

Revision history for this message
cwsupport (netsupport) wrote :

I dont think this has anything to do with #104091, but #114

Initially on system boot ntpd fails to start properly and comes up to early. Immediately after boot ntpq -p shows no assoc IDs, then when you do /etc/init.d/ntp restart everything is fine - which is why the above behaviour has occured.

I have re-opened 114505 because it simply isnt fixed as described.

Revision history for this message
cwsupport (netsupport) wrote :

oops that first ID should be #114505.

There is an additional problem here in that /etc/init.d/ntp doesnt call ntpdate-debian during start/restart so therefore if your server is > min drift which stops auto sync you are left having to fix ntpdate by hand (ntpdate-debian is a better way than simply using ntpdate).

Revision history for this message
Chuck Short (zulcss) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the development release - Karmic Koala. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at http://www.ubuntu.com/testing/. Thanks again and we appreciate your help.

Changed in ntp (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
psl (slansky) wrote :

Important information is missing here. This Linux machine was running under VMware. Such configuration needs extra parameter to kernel to keep correct time.

More detail can be found here, for example.

http://communities.vmware.com/message/776326
http://support.ntp.org/bin/view/Support/VMWareNTP

VMware has a nice paper about this issue and solution too.
http://www.vmware.com/pdf/vmware_timekeeping.pdf

Revision history for this message
Chuck Short (zulcss) wrote :

We'd like to figure out what's causing this bug for you, but we haven't heard back from you in a while. Could you please provide the requested information? Thanks!

Revision history for this message
Chuck Short (zulcss) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in ntp (Ubuntu):
status: Incomplete → Invalid
Changed in ntp (Ubuntu):
status: Invalid → New
Revision history for this message
Jorge Moraleda (jorge-moraleda) wrote :

I just reopened the bug. It is affecting me too. I am running 64 bit Karmic Koala up to date. This computer is always on. It has continuous access to the internet and is not a virtual machine.

> sudo /etc/init.d/ntp status
 * NTP server is running.

> grep ^server /etc/ntp.conf
server ntp.ubuntu.com

My clock is more than 13 minutes off.

Revision history for this message
Mathias Gug (mathiaz) wrote :

ntpd won't reset the clock if the time difference is above 0.5s (or something of this order). I'd suggest to first adjust your time manually, then run ntpd.

Changed in ntp (Ubuntu):
status: New → Incomplete
Revision history for this message
Jorge Moraleda (jorge-moraleda) wrote :

Ok, but then the question is. How/why did this happen? Did ntpdate not get called when I first installed package ntp? (Years ago), and my clock has been always out of sync and drifting I did just notice? (possible) or did the clock get out of sync when I turned off the machine for a couple of weeks because I was on vacation? (also possible). Should ntpdate be set to run by default on boot when installing package ntp?

Revision history for this message
Jorge Moraleda (jorge-moraleda) wrote :

Ok, after further research, it seems that ntp really is not working on my system:
ntpdate returns "no server suitable for synchronization found" every time regardless of what server I point it too, and ntpq -p does not have star next to any server and reach, delay, offset, and jitter all show 0.

Revision history for this message
Jorge Moraleda (jorge-moraleda) wrote :

Never mind... Our firewall seems to block the ntp port. Synchronizing with an internal server makes both ntp and ntddate work. Sorry for the confusion.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Closing again per last comment.

Changed in ntp (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.