You are not logged in.

#1 2005-05-11 09:53:48

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

I can't get ntp to work properly

I've tried both openntpd and the standard ntpd. Neither syncs time properly on any of my linux boxen. I have openntpd installed on my openbsd box, which happens to be my router. It acts as a local time server for the network. All the windows xp boxes have no problem whatsoever syncing to it, and they all maintain perfect time.

The linux boxen all drift erratically. There are no errors, nothing... just the time floats off.

Does anybody have any ideas?

Offline

#2 2005-05-11 10:57:44

scarecrow
Member
From: Greece
Registered: 2004-11-18
Posts: 715

Re: I can't get ntp to work properly

Do you happen to dualboot the machine(s) with windows-something? If you do then you should not use HARDWARECLOCK="UTC" on your /etc/rc.conf


Microshaft delenda est

Offline

#3 2005-05-11 18:55:40

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

Did you run rdate -s timeserver_address (as root) before running openntpd on your linux boxes? (or you can change /etc/rc.d/ntpd script and add -s after ntpd - it will force first full synchronization).

This is because if the difference in time is big openntpd will adjust time very very slowly. You have to first setup correct time and then ntpd will take care of it.

Also what's the openntpd configuration on the router ?

No single message in /var/log/daemon.log (linux box, router) ?

Do you have firewall setup on the router and/or linux box?

EDIT: I'm using openntpd and everything seems to work ok (arch router/server and arch destktop machine both running openntpd)

Offline

#4 2005-05-11 19:56:05

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: I can't get ntp to work properly

I have IPCop as my time server, and I just use ntpdate on my LAN boxes. I run it from rc.local, so they sync up on every reboot, although I'm thinking of cronning it as well.

Offline

#5 2005-05-11 21:15:43

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

I sync when it starts. I do not dual boot, this is pure arch. I have localtime set to EST5EDT and the BIOS clock to UTC. All three machines that are doing this are servers, and all run Arch. They all sync before starting ntpd. They are all off by their various drift amounts after a few weeks, and ntpd has done zilch to do anything about it. Both ntpd and openntpd are guilty.

The conf on the router obviously works, because the router's time is perfect, and the windows machines can sync to it no problem. Here it is anyway:

listen on 192.168.1.1
server rolex.usg.edu

It's extremely simple...

No errors in any log file - none! Nor is there a firewall on the client machines. The router obviously runs pf (packet filter) but the requests and responses must be getting through for the windows machines to work peachy. I'm convinced it's a client side configuration problem or a bug. Probably a config problem.

Here's the client config:

server 192.168.1.1

which is also brain dead simple, so now I really have no idea.

btw, the time gets off faster when I use ntp.

Edit: This is very curious

The linux machines cannot rdate to the router, but the windows machines can. Watching the dropped packets log on pf, however, there are no dropped packets when I try to rdate to the router. I even turn off filtering altogether (leaving me very vulnerable) it didn't work. The router must not be the problem.

I haven't the foggiest why the linux machines won't rdate to my router, but they'll rdate to external computers, while my windows machines have no trouble. They're all on the same network segment.

...and wtf?! ntpdate from the linux machines works fine, but not ntpd nor openntpd nor rdate. Argh!!!

Offline

#6 2005-05-11 23:12:51

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

AFAIK rdate doesn't use ntp (udp port 123). It uses tcp port 37 (timeserver) so it's "normal" that it can't synchronize with your local openntpd server.
Many external time servers provide this service and it works with them. Nothing to worry about. Same thing can be done when you run ntpd -s instead of just ntpd.

I really don't know what's the problem. Looks like some config problem. Openntpd configuration is indeed extremely simple and I can't see anything wrong with it.

For me openntpd works fine on both server and desktop so I'm sure it's not arch's fault (I can see ntpd[4166]: adjusting local clock by 0.216760s in my /var/log/daemon.log on the desktop machine so it works). The lack of logs can be explained because openntpd doesn't log every single update IIRC. Only if it is greater than some value (I don't remember what's the actual number).

But you say it doesn't correct your time on linux machines. I'm sure this must be something simple... Try running ntpd -s -d -f /etc/ntpd.conf from command line. It will log to stderr and maybe it will show something more?

Offline

#7 2005-05-11 23:32:46

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: I can't get ntp to work properly

What does the rest of your /etc/ntp.conf look like?  Mine looks like:

restrict 127.0.0.1 nomodify
# Router accepts these servers (port 123)
server ntp.cpsc.ucalgary.ca
server ntp2.cmc.ec.gc.ca
server time.chu.nrc.ca
server time.nrc.ca
driftfile /etc/ntp.drift
logfile /var/log/ntp.log

I had to punch a hole through my router.  Have you done that?  Also, if I recall correctly, I had to add the "restrict 127.0.0.1 nomodify" for it to work (i.e. didn't work as pacman layed it down).

Also, what does ntpq spit out?  Mine spits out:

[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ensb.cpsc.ucalg 18.26.4.105      2 u  216 1024  377  113.092    3.999   2.199
*wxo-svr2.cmc.ec 18.145.0.30      2 u  303 1024  377  128.586   12.723   2.865
+time1.chu.nrc.c 209.87.233.52    2 u  200 1024  177  133.748   10.345 146.635
+time.nrc.ca     132.246.168.3    2 u  266 1024  377  157.258    7.627   5.612

Offline

#8 2005-05-11 23:38:22

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

soloport: openntpd has more simple configuration than ntpd (it's also called /etc/ntpd.conf). There is nothing else needed :-)

Offline

#9 2005-05-12 00:11:49

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

I had it running in the foreground, dumping to a log file. It says correcting for error xx.xxx sec, but the margin it corrects for just keeps getting bigger and bigger and bigger... it never actually performs the correction.

Offline

#10 2005-05-12 03:46:42

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: I can't get ntp to work properly

lanrat wrote:

soloport: openntpd has more simple configuration than ntpd (it's also called /etc/ntpd.conf). There is nothing else needed :-)

Ah.  Missed that.  Read the orig. post too quickly:

kleptophobiac wrote:

I've tried both openntpd and the standard ntpd. Neither syncs time properly on any of my linux boxen.

(Plust the topic was "I can't get ntp to work properly".)

Offline

#11 2005-05-12 08:09:58

Kern
Member
From: UK
Registered: 2005-02-09
Posts: 464

Re: I can't get ntp to work properly

confused as to what your tryna do, (ntp or ntpd) set up a daemon or just sync time so your PC has the right clock settings.
Compare
http://linuxreviews.org/man/ntpd/
http://linuxreviews.org/howtos/ntp/

but if its the latter.... maybe just a one line executable, issue it at your whim, or cron it.

[root@localhost ~]#cat time.sh 
/usr/bin/ntpdate ntp1.cs.wisc.edu

or a timeserver you find to be reliable.

./time.sh
Looking for host ntp1.cs.wisc.edu and service ntp
host found : caesar.cs.wisc.edu
12 May 09:02:51 ntpdate[5121]: step time server 128.105.39.11 offset -12.408688 sec

Edit: just found an excellent Howto that may help with both ...
http://www.ibiblio.org/pub/Linux/docs/H … HOWTO.html

hth

Offline

#12 2005-05-12 08:57:19

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

kleptophobiac wrote:

I had it running in the foreground, dumping to a log file. It says correcting for error xx.xxx sec, but the margin it corrects for just keeps getting bigger and bigger and bigger... it never actually performs the correction.

Ok. There are 4 things which you can check:

1. Wrong (old or unpatched) openntpd version (which version are you using? where did you get it? do you have any linux-specific patches applied?).

2. Problem witch some kernel versions and / or hardware configurations (there are reports about this).

3. Wrong permissions.

4. Everything together :-)

I can post my openntpd PKGBUILD later (when I get back home) if you want me to.

Also read the following threads from gentoo forums:
http://forums.gentoo.org/viewtopic-t-28 … nntpd.html
http://forums.gentoo.org/viewtopic-t-30 … nntpd.html

I'm not sure if there is some ultimate answer but you can try things described there.

I think the best solution is to apply linux patches first if you don't have them already.

Offline

#13 2005-05-12 10:07:27

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

I'm trying to get a linux client. My openbsd server appears to work.

I'm running openntpd from the link in the wiki, it's almost the newest version.  3.6p1 I believe. I also have the latest arch stock kernel.

Offline

#14 2005-05-13 01:53:06

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

I have updated openntpd pkgbuild and included the patches mentioned above. I have also made a pkgbuild for adjtimex which can be useful (should work more or less like timeadj mentioned in the gentoo threads).
It's all here now:
http://bbs.archlinux.org/viewtopic.php?p=87471

Offline

#15 2005-05-21 02:08:54

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

It's still supremely borked...

May 20 20:41:39 mythfe01 ntpd[5449]: adjusting local clock by -94.413285s
May 20 20:43:39 mythfe01 ntpd[5449]: adjusting local clock by -95.805290s
May 20 20:46:39 mythfe01 ntpd[5449]: adjusting local clock by -96.957144s
May 20 20:49:09 mythfe01 ntpd[5449]: adjusting local clock by -98.554994s
May 21 00:50:24 mythfe01 ntpd[5450]: peer 192.168.1.1 now invalid
May 21 00:50:39 mythfe01 ntpd[5450]: peer 192.168.1.1 now valid
May 20 20:50:54 mythfe01 ntpd[5449]: adjusting local clock by -99.525526s
May 20 20:54:24 mythfe01 ntpd[5449]: adjusting local clock by -100.239288s
May 20 20:56:24 mythfe01 ntpd[5449]: adjusting local clock by -101.627219s
May 20 20:59:54 mythfe01 ntpd[5449]: adjusting local clock by -102.540464s
May 20 21:03:24 mythfe01 ntpd[5449]: adjusting local clock by -102.839532s
May 20 21:04:54 mythfe01 ntpd[5449]: adjusting local clock by -103.342654s
May 20 21:07:24 mythfe01 ntpd[5449]: adjusting local clock by -103.825717s
May 20 21:09:24 mythfe01 ntpd[5449]: adjusting local clock by -104.585864s
May 20 21:12:54 mythfe01 ntpd[5449]: adjusting local clock by -104.689874s
May 20 21:13:24 mythfe01 ntpd[5449]: adjusting local clock by -105.582026s
May 20 21:17:24 mythfe01 ntpd[5449]: adjusting local clock by -105.873591s
May 20 21:18:54 mythfe01 ntpd[5449]: adjusting local clock by -106.062471s
May 20 21:19:54 mythfe01 ntpd[5449]: adjusting local clock by -106.983540s
May 20 21:23:24 mythfe01 ntpd[5449]: adjusting local clock by -107.176516s
May 20 21:23:54 mythfe01 ntpd[5449]: adjusting local clock by -107.564492s
May 20 21:24:54 mythfe01 ntpd[5449]: adjusting local clock by -108.641376s
May 20 21:27:24 mythfe01 ntpd[5449]: adjusting local clock by -109.697279s
May 20 21:29:54 mythfe01 ntpd[5449]: adjusting local clock by -110.851130s
May 20 21:32:24 mythfe01 ntpd[5449]: adjusting local clock by -111.068118s
May 20 21:32:54 mythfe01 ntpd[5449]: adjusting local clock by -111.715066s
May 20 21:34:24 mythfe01 ntpd[5449]: adjusting local clock by -113.318039s
May 20 21:37:54 mythfe01 ntpd[5449]: adjusting local clock by -114.264946s
May 20 21:39:54 mythfe01 ntpd[5449]: adjusting local clock by -115.213817s
May 20 21:41:54 mythfe01 ntpd[5449]: adjusting local clock by -116.801644s
May 20 21:45:24 mythfe01 ntpd[5449]: adjusting local clock by -118.614409s
May 20 21:49:24 mythfe01 ntpd[5449]: adjusting local clock by -120.147240s
May 20 21:52:54 mythfe01 ntpd[5449]: adjusting local clock by -120.567204s
May 20 21:53:54 mythfe01 ntpd[5449]: adjusting local clock by -120.949335s
May 20 21:54:54 mythfe01 ntpd[5449]: adjusting local clock by -121.153318s
May 20 21:55:24 mythfe01 ntpd[5449]: adjusting local clock by -122.579150s
May 20 21:58:54 mythfe01 ntpd[5449]: adjusting local clock by -122.869253s
May 20 21:59:54 mythfe01 ntpd[5449]: adjusting local clock by -123.228235s
May 20 22:00:54 mythfe01 ntpd[5449]: adjusting local clock by -124.338114s
May 20 22:03:24 mythfe01 ntpd[5449]: adjusting local clock by -126.011917s
May 20 22:07:24 mythfe01 ntpd[5449]: adjusting local clock by -127.272907s

Offline

#16 2005-05-21 16:20:01

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: I can't get ntp to work properly

So, I think it's not related to nptd or openntpd and their latest versions. I've seen some reports with similar results but no ultimate solution.

On my system it _seems_ to work (I've even compared it to radio controlled clock and time is the same after a few days).

It can be realted to system clock time drift beeing too large for ntpd.
This means there is something wrong with your system clock (kernel) or hardware or both.

What's the output of hwclock and date? What if you run them several times? (try that with ntpd turned off).

You can try adjusting system clock using adjtimex tool. First print current values with adjtimex --print (and save them just in case). Then you can try setting -t or -f option (full description is in the adjtimex manpage).

No guarantee it will work but it's worth a try IMO. It should reduce system clock time drift. Perhaps then ntpd will work correctly on your system (I've read somewhere that the time drift should be first less than 1 sec).

Some people also report problems with system clock running too fast when using SMP or nforce hardware or HT CPU.

Offline

#17 2005-05-21 18:37:35

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

Well, one of the boxes exhibiting this problem is an nforce unit... but I have no idea how to fix it. The solutions I've found on this forum don't seem to cut it for me. I think I only noticed it with the stock 2.6.11.x kernel.

Offline

#18 2005-06-01 12:36:58

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: I can't get ntp to work properly

kleptophobiac wrote:

Well, one of the boxes exhibiting this problem is an nforce unit... but I have no idea how to fix it. The solutions I've found on this forum don't seem to cut it for me. I think I only noticed it with the stock 2.6.11.x kernel.

Well, now I think you're on to something.  A week ago I setup a box using a new m/b I'd not tried before -- nforce chipset (have only used VIA or SiS chipsets before).  About four days ago the box just stoped COLD.  I started it up again and it died a day later.  After changing out the clock battery, it seemed to do better (no more sudden death -- yet).

However, that's when I discovered the same problem you're describing.  After changing the battery out, I expected the clock to be screwy.  I adjusted it (so I thought) and setup ntpd.  Now I can watch it drift away! (Using "watch 'ntpq -p'".)

I hope one of us finds the solution.  However, I'd guess it's probably related to the kernel/ntpd/nforce combination.  All other non-nforce servers are doing fine with the latest, stock kernel/ntpd packages.

[Edit] Ok, solution is here, apparently: http://bbs.archlinux.org/viewtopic.php? … hlight=ntp

Offline

#19 2005-06-01 19:14:36

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

my nforce box magically started working with the new openntpd posted in this thread, which is nice. The other box, a dell SC420 seems chronically wrong. There seems to be a problem with the way the Dell BIOS handles rtc calls. I'm considering updating to a newer bios and hoping it works. The drift got a little slower when I disabled hyperthreading, but it is still on the order of several seconds a day, and ntpd seems incapable of keeping it right.

Offline

#20 2005-06-02 23:55:02

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: I can't get ntp to work properly

I just aliased rtc to genrtc in my modprobe.conf... I suspect that might make things work better. With the standard rtc module, I couldn't use hwclock without the directisa parameter, and I don't know how to set the parm for what ntpd uses.

Offline

Board footer

Powered by FluxBB