[pkg-ntp-maintainers] Bug#542602: ntp: Should ntp update clock before or after the syslog collector starts?

Petter Reinholdtsen pere at hungry.com
Thu Aug 20 11:10:43 UTC 2009


Package:  ntp
Version:  1:4.2.4p6+dfsg-2
Severity: important
User:     initscripts-ng-devel at lists.alioth.debian.org
Usertags: incorrect-dependency

I discovered this problem while working on the dependency based boot
sequencing.  The issue at hand is in what order the ntp and syslog
services should start during boot, and related to this is the
definition of the $time virtual facility.

Services requiring correct clock is supposed to have their init.d
script depend on $time to get this.  At the moment in Debian, $time do
not imply that ntp is active, because it would lead to a dependency
loop.  The problem affects all syslog implementations, and for
simplicity my example only include rsyslog.

These are the dependency headers in question:

### BEGIN INIT INFO
# Provides:          rsyslog
# Required-Start:    $remote_fs $time
# Required-Stop:     umountnfs $time
# X-Stop-After:      sendsigs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

### BEGIN INIT INFO
# Provides:        ntp
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
### END INIT INFO

The ntp daemon want to log to syslog, and thus depend on $syslog.  The
syslog daemon want a correct clock, and thus depend on $time.  If
$time implies ntp to be started, we have a dependency loop like this:

  rsyslog -> $time -> ntp -> $syslog -> rsyslog

I believe the correct behaviour is for syslog to get a correct clock,
and this can be done by splitting the ntp script in two, one setting
the clock once during boot, and the other starting the daemon.  The
$time virtual facility can then depend on the once-during-boot script,
and the existing ntp script can continue depending on $syslog, leading
to this dependency thread:

  ntp -> $syslog -> rsyslog -> $time -> ntp-once

An alternative, is for the ntp daemon to start before the syslog
collector is operational, loose a few syslog messages during boot and
get a correct clock in the syslog messages.  For this to happpen, ntp
would need to drop its dependency on $syslog.

What is your opinion on this?  I am aware that you recently dropped
the ntpdate script, which would have made sense to run before the
syslog implementation was operational.

Before this issue is resolved, it is impossible to change the
definition of $time to match the LSB specification:

  $time	 	

    the system time has been set, for example by using a network-based
    time program such as ntp or rdate, or via the hardware Real Time
    Clock.

At the moment it only uses the hardware real time clock.

Happy hacking,
-- 
Petter Reinholdtsen





More information about the pkg-ntp-maintainers mailing list