Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 42987 - /etc/init.d/ntpd fails to clear .pid file after ntpd startup failure
Summary: /etc/init.d/ntpd fails to clear .pid file after ntpd startup failure
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on: 39919
Blocks:
  Show dependency tree
 
Reported: 2004-02-26 07:31 UTC by J Sacksteder
Modified: 2004-03-12 15:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Sacksteder 2004-02-26 07:31:35 UTC
If ntpd fails to start, .pid file is not removed. On next startup attempt, script fails to start. Most other init scripts will report that the program is already running in that situation. That will inform the user that a '/etc/init.d/ntpd zap' 
is required to reset the situation. ntpd-4.1.2 just says 'failed to start ntpd'. That is somewhat less than helpful.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Steven Wagner 2004-03-04 16:05:06 UTC
Why is ntpd failing to start...what is the error ?  Maybe if we checked for an error code we could do something about it.  The problem you are reporting isn't really a ntpd bug, but also happens with bind, mysql, apache...if there is an error.
Comment 2 Steven Wagner 2004-03-04 17:53:26 UTC
this may be related to a problem I am having with starting ntpd or ntp-client init scripts.  I get a chown error that is being caused by this line in the init scripts.
 chown ntp:ntp /var/run/ntpd.pid

The ebuild never created a ntp user or group, so this line just fails.
Comment 3 SpanKY gentoo-dev 2004-03-04 20:31:20 UTC
i dont know how you emerged ntp but every ebuild since 4.1.2 has added the ntp user/group
Comment 4 Steven Wagner 2004-03-04 22:56:38 UTC
oh, yah, you are right.  

the way that the later ebuilds to the init script works...

start() {
        checkconfig || return $?
 
        ebegin "Starting ntpd"
        touch /var/run/ntpd.pid
        chown ntp:ntp /var/run/ntpd.pid
        /usr/bin/ntpd -p /var/run/ntpd.pid ${NTPD_OPTS}
        eend $? "Failed to start ntpd"
}
 
stop() {
        ebegin "Stopping ntpd"
        if [ -e /var/run/ntpd.pid ] ; then
                kill `cat /var/run/ntpd.pid`
                rm -f /var/run/ntpd.pid
        fi
        eend $? "Failed to stop ntpd"
}



since there are major bugs open on the later builds...possibly this init should be backported, in addition to the ntp group -> ntp:ntp in the conf.d/ntpd fix.
Comment 5 SpanKY gentoo-dev 2004-03-12 15:50:57 UTC
everything is as it should be