View previous topic :: View next topic |
Author |
Message |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 2:44 am Post subject: NTPD: Bug?? |
|
|
Hello,
After lots of playing around I have got ntpd working: synchs to stratum 2 server and synchs local winxp machines.
I did notice a problem: I dont know if this is a bug or a configuration error.
Code: |
silent-srvr:> /etc/init.d/ntpd start <---- works fine
silent-srvr:> /etc/init.d/ntpd stop <---- stops fine
silent-srvr:> /etc/init.d/ntpd start <--- fails!!!
|
Same results for:
Code: |
silent-srvr:> /etc/init.d/ntpd restart <----- stops fine then fails on restart
|
It appears the lock file is not removed when ntpd exits and then ntpd refuses to restart since it finds a lock file...
So to restart I need to :
Code: |
silent-srvr:> /etc/init.d/ntpd stop
silent-srvr:> rm /var/run/ntpd.pid
silent-srvr:> /etc/init.d/ntpd start
|
Okay.... Whats up? Why is this not working...
In the init.d script it is using start-stop-daemon. I thought this was supposed to automaticly make and remove lock /pid files.
Thanks....
BRENT |
|
Back to top |
|
 |
Epyon l33t


Joined: 11 Sep 2003 Posts: 754 Location: NJ, USA
|
Posted: Sun Mar 14, 2004 3:01 am Post subject: |
|
|
Code: |
raptor root # /etc/init.d/ntpd restart
* Stopping ntpd... [ ok ]
* Starting ntpd... [ ok ]
raptor root # /etc/init.d/ntpd stop
* Stopping ntpd... [ ok ]
raptor root # /etc/init.d/ntpd start
* Starting ntpd... [ ok ]
|
works fine for me |
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 5:30 pm Post subject: Whats the deal?? |
|
|
Anyone know why the lock file might not be removed?? |
|
Back to top |
|
 |
nbensa l33t


Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sun Mar 14, 2004 5:47 pm Post subject: |
|
|
show us: Code: | $ cat /etc/conf.d/ntp* |
|
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 6:08 pm Post subject: /etc/ntp.conf & /etc/conf.d/ntp |
|
|
Here is /etc/conf.d/ntp with all comments stripped
Here is /etc/ntp.conf with all comments stripped
Code: |
logfile /var/log/ntpd.log
driftfile /var/lib/ntp/ntp.drift
server clock.fmt.he.net prefer
server clock.sjc.he.net
server ntp1.linuxmedialabs.com
restrict default notrust nomodify
restrict 127.0.0.1
restrict 192.168.0.22
restrict 192.168.0.0 mask 255.255.255.0 nomodify
|
brent
Last edited by bch on Sun Mar 14, 2004 6:33 pm; edited 1 time in total |
|
Back to top |
|
 |
nbensa l33t


Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sun Mar 14, 2004 6:14 pm Post subject: Re: /etc/ntp.conf & /etc/conf.d/ntp |
|
|
bch wrote: | Here is /etc/conf.d/ntp with all comments stripped
Code: |
NTPCLIENT_CMD="ntpdate"
NTPD_OPTS="-U ntp"
|
|
What happen if you comment out NTPCLIENT_CMD?
BTW, are you using 4.2? IME, ntp 4.2 didn't work. I've reverted back to 4.1.1b and it fixed all my problems. |
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 6:33 pm Post subject: NTPD: Bug?? |
|
|
Im running the following version:
Code: |
silent-srvr root # ntpd --version
ntpd: ntpd 4.1.2@1.892 Fri Mar 12 23:05:15 PST 2004 (1)
|
Opps... The NTPCLIENT_CMD="ntpdate" came from /etc/conf.d/ntp-client.
I edited previous post to make correct. |
|
Back to top |
|
 |
nbensa l33t


Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sun Mar 14, 2004 7:07 pm Post subject: |
|
|
Do you have a stale ntp process running? Try "killall ntpd" as root. |
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 7:20 pm Post subject: OK... I think you are on to it. |
|
|
Code: | silent-srvr root # ps aux | grep ntp
root 3044 0.0 0.4 2116 2108 ? SL Mar12 0:02 ntpd -p localhost
root 3330 0.0 0.4 2244 2208 ? S Mar12 0:00 ntpd -p localhost
root 14478 0.0 0.4 2160 2152 ? SL Mar12 0:02 ntpd -pe
root 12966 0.0 0.4 2288 2252 ? S Mar12 0:00 ntpd -pe
ntp 21255 0.0 0.4 2312 2304 ? SL Mar13 0:01 /usr/bin/ntpd -p /var/run/ntpd.pid -U ntp
root 24634 0.0 0.0 1524 436 pts/1 R 11:15 0:00 grep ntp
silent-srvr root # /etc/init.d/ntpd stop
* Stopping ntpd... [ ok ]
silent-srvr root # ps aux | grep ntp
root 3044 0.0 0.4 2116 2108 ? SL Mar12 0:02 ntpd -p localhost
root 3330 0.0 0.4 2244 2208 ? S Mar12 0:00 ntpd -p localhost
root 14478 0.0 0.4 2160 2152 ? SL Mar12 0:02 ntpd -pe
root 12966 0.0 0.4 2288 2252 ? S Mar12 0:00 ntpd -pe
root 8136 0.0 0.0 1516 440 pts/1 R 11:16 0:00 grep ntp
silent-srvr root # killall ntpd
silent-srvr root # ps aux | grep ntp
root 13398 0.0 0.0 1528 440 pts/1 R 11:16 0:00 grep ntp
silent-srvr root #
|
It appears that the /etc/init.d/ntpd script is not shutting ntpd down.. The question now would be why?
Code: |
silent-srvr root # cat /etc/init.d/ntpd
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd-4.1.2.rc,v 1.1 2004/02/14 22:58:02 vapier Exp $
depend() {
need net
use dns logger
after ntp-client
}
checkconfig() {
if [ ! -f /etc/ntp.conf ] ; then
eerror "Please create /etc/ntp.conf"
eerror "Sample conf: /usr/share/ntp/ntp.conf"
return 1
fi
return 0
}
start() {
checkconfig || return $?
ebegin "Starting ntpd"
touch /var/run/ntpd.pid
chown ntp:ntp /var/run/ntpd.pid
start-stop-daemon --start --quiet --pidfile /var/run/ntpd.pid \
--startas /usr/bin/ntpd -- -p /var/run/ntpd.pid ${NTPD_OPTS}
eend $? "Failed to start ntpd"
}
stop() {
ebegin "Stopping ntpd"
start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
eend $? "Failed to stop ntpd"
}
|
|
|
Back to top |
|
 |
nbensa l33t


Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sun Mar 14, 2004 7:59 pm Post subject: Re: OK... I think you are on to it. |
|
|
bch wrote: | Code: | silent-srvr root # ps aux | grep ntp
root 3044 0.0 0.4 2116 2108 ? SL Mar12 0:02 ntpd -p localhost
root 3330 0.0 0.4 2244 2208 ? S Mar12 0:00 ntpd -p localhost
root 14478 0.0 0.4 2160 2152 ? SL Mar12 0:02 ntpd -pe
root 12966 0.0 0.4 2288 2252 ? S Mar12 0:00 ntpd -pe
ntp 21255 0.0 0.4 2312 2304 ? SL Mar13 0:01 /usr/bin/ntpd -p /var/run/ntpd.pid -U ntp
root 24634 0.0 0.0 1524 436 pts/1 R 11:15 0:00 grep ntp
|
|
I think the question is "why is your box running 4 instances of ntpd?"
All my boxes show only ONE process. Can you please run: Code: | # /usb/sbin/ntpd -d -n -p /var/run/ntpd.pid -U ntp |
and watch its output? BTW, what does /var/log/ntpd.log says? |
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 8:43 pm Post subject: NTPD |
|
|
I believe I had four running probably because I didnt realize that when I was running "/etc/init.d/ntpd stop" it wasnt really stopping ntpd. So then I would "rm /var/run/ntpd.pid" and then "/etc/init.d/ntpd start" and would end up with multiple instances.... Sound about right correct?
Now when I do:
Code: | silent-srvr root # ps aux | grep ntpd
ntp 26933 0.0 0.4 2312 2304 ? SL 12:32 0:00 /usr/bin/ntpd -p /var/run/ntpd.pid -U ntp
silent-srvr root #
|
|
|
Back to top |
|
 |
nbensa l33t


Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sun Mar 14, 2004 8:47 pm Post subject: |
|
|
Sounds correct. So it stops now? |
|
Back to top |
|
 |
bch n00b


Joined: 05 Mar 2004 Posts: 27
|
Posted: Sun Mar 14, 2004 9:28 pm Post subject: |
|
|
It appears to be stopping ok... But it still leaves the ntpd.pid file and then I cannot restart unless I first remove the pid file.
Code: | silent-srvr bin # /etc/init.d/ntpd stop
* Stopping ntpd... [ ok ]
silent-srvr bin # ps aux | grep ntp
root 14359 0.0 0.0 1512 440 pts/0 S 13:25 0:00 grep ntp
silent-srvr bin # /etc/init.d/ntpd start
* Starting ntpd...
* Failed to start ntpd [ !! ]
silent-srvr bin # rm /var/run/ntpd.pid
silent-srvr bin # /etc/init.d/ntpd start
* Starting ntpd... [ ok ]
silent-srvr bin # ps aux | grep ntp
ntp 12603 0.0 0.4 2312 2304 ? SL 13:26 0:00 /usr/bin/ntpd -p /var/run/ntpd.pid -U ntp
root 3149 0.0 0.0 1552 440 pts/0 S 13:26 0:00 grep ntp
silent-srvr bin #
|
|
|
Back to top |
|
 |
kikibobo n00b

Joined: 02 Feb 2004 Posts: 42 Location: Dublin
|
Posted: Sun Mar 21, 2004 10:53 pm Post subject: |
|
|
For what it's worth, I'm having exactly the same problem.  |
|
Back to top |
|
 |
UberLord Retired Dev


Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Mar 21, 2004 11:29 pm Post subject: |
|
|
The latest version in portage (~x86) works fine for me |
|
Back to top |
|
 |
alb n00b


Joined: 12 Sep 2003 Posts: 5 Location: Torino, Italy
|
Posted: Tue Mar 23, 2004 6:23 pm Post subject: |
|
|
Hi all
I just emerged ntp and I got exactly the same problem for restarting
Does this mean that next time I reboot ntp will not start? |
|
Back to top |
|
 |
|