[pkg-ntp-maintainers] Bug#514318: lockfile can cause long startup delays, questionable benefit

martin f krafft madduck at debian.org
Fri Feb 6 08:42:17 UTC 2009


Package: ntp
Version: 1:4.2.4p4+dfsg-8
Severity: normal

On a lenny system, whose DNS servers are broken right now, the ntp initscript
hangs for ~4 minutes, delaying the whole boot sequence.

Closer investigation shows that it idles in lock_ntpdate's invocation of
lockfile-create. I appreciate that it is trying to play nicely with e.g.
/etc/network/if-up.d/ntpdate (for which I also enabled trace in the output
below), but this kind of deadlock seems really unnecessary:

  [...]
  Will now mount local filesystems:.
  Will now activate swapfile swap:done.
  Cleaning /tmp...done.
  Cleaning /var/run...done.
  Cleaning /var/lock...done.
  Checking minimum space in /tmp...done.
  Setting up resolvconf...done.
  Setting up networking....
  Configuring network interfaces...+ exit 0
  + set -e
  + PATH=/sbin:/bin:/usr/sbin:/usr/bin
  + '[' loopback = static ']'
  + '[' loopback = loopback ']'
  + exit 0
  + exit 0
  + set -e
  + PATH=/sbin:/bin:/usr/sbin:/usr/bin
  + '[' static = static ']'
  + OPTS=-b
  + '[' static = loopback ']'
  + '[' '!' -x /usr/sbin/ntpdate-debian ']'
  + '[' -r /lib/udev/hotplug.functions ']'
  + . /lib/udev/hotplug.functions
  ++ FIRMWARE_DIRS='/lib/firmware /usr/local/lib/firmware
  /usr/lib/hotplug/firmware'
  ++ EVENTS_DIR=/dev/.events
  ++ MODPROBE='/sbin/modprobe -s -q'
  ++ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  INIT: Entering runlevel: 2
  Starting watchdog keepalive daemon: wd_keepalive.
  Starting system logging: syslog-ng.
  Starting OpenBSD Secure Shell server: sshd.
  Not starting internet superserver: no services enabled.
  Starting Postfix Mail Transport Agent: postfix.
  Starting S.M.A.R.T. daemon: smartd.
  Starting puppet configuration management tool.
  + PATH=/sbin:/bin:/usr/sbin:/usr/bin
  + . /lib/lsb/init-functions
  ++ FANCYTTY=
  ++ '[' -e /etc/lsb-base-logging.sh ']'
  ++ true
  + NAME=ntp
  + DAEMON=/usr/sbin/ntpd
  + PIDFILE=/var/run/ntpd.pid
  + test -x /usr/sbin/ntpd
  + '[' -r /etc/default/ntp ']'
  + . /etc/default/ntp
  ++ NTPD_OPTS=-g
  + '[' -e /etc/ntp.conf.dhcp ']'
  + LOCKFILE=/var/lock/ntpdate
  + RUNASUSER=ntp
  ++ getent passwd ntp
  ++ cut -f 3,4 -d:
  + UGID=106:107
  + case $1 in
  + log_daemon_msg 'Starting NTP server' ntpd
  + '[' -z 'Starting NTP server' ']'
  + log_daemon_msg_pre 'Starting NTP server' ntpd
  + :
  + '[' -z ntpd ']'
  + echo -n 'Starting NTP server: ntpd'
  Starting NTP server: ntpd+ log_daemon_msg_post 'Starting NTP server' ntpd
  + :
  + '[' -z 106:107 ']'
  + lock_ntpdate
  + '[' -x /usr/bin/lockfile-create ']'
  + lockfile-create /var/lock/ntpdate

  [3 minutes here, then resumes...]

  lockfile creation failed
  + lockfile-touch /var/lock/ntpdate
  + LOCKTOUCHPID=2455
  + start-stop-daemon --start --quiet --oknodo --pidfile /var/run/ntpd.pid --startas /usr/sbin/ntpd -- -pg
  + status=0
  + unlock_ntpdate
  + '[' -x /usr/bin/lockfile-create ']'
  + kill 2455
  + lockfile-remove /var/lock/ntpdate
  + log_end_msg 0
  + '[' -z 0 ']'
  + retval=0
  + log_end_msg_pre 0
  + :
  + log_use_fancy_output
  + TPUT=/usr/bin/tput
  + EXPR=/usr/bin/expr
  + '[' -t 1 ']'
  + '[' xlinux '!=' '' ']'
  + '[' xlinux '!=' xdumb ']'
  + '[' -x /usr/bin/tput ']'
  + '[' -x /usr/bin/expr ']'
  + /usr/bin/tput hpa 60
  + /usr/bin/tput setaf 1
  + '[' -z ']'
  + FANCYTTY=1
  + case "$FANCYTTY" in
  + true
  ++ /usr/bin/tput setaf 1
  + RED=''
  ++ /usr/bin/tput setaf 3
  + YELLOW=''
  ++ /usr/bin/tput op
  + NORMAL=''
  + '[' 0 -eq 0 ']'
  + echo .
  .
  + log_end_msg_post 0
  + :
  + return 0
  Starting MD monitoring service: mdadm --monitor.
  Starting ftp server: proftpd.
  Starting deferred execution scheduler: atd.
  Starting periodic command scheduler: crond.
  Stopping watchdog keepalive daemon: 
  Starting watchdog daemon: watchdog.
  Starting web server: apache2.
  Starting authentication failure monitor: fail2ban.
  Running local boot scripts (/etc/rc.local).
  Stopping boot logger: bootlogd
  [...]

After a while, the following is then printed to the console:

  + :
  + '[' -x /usr/bin/lockfile-create ']'
  + kill 2182
  /etc/network/if-up.d/ntpdate: line 45: kill: (2187) - No such process

So it seems that the root cause is ntpdate's inability to deal with
broken DNS (separate bug report to be filed).

At the time the boot finally completed, ntpdate and ntpd were both
running, which makes me question the point of the lockfile. The
initscript really ought not to hold up the whole boot sequence, even
if ntpdate has a problem.

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ntp depends on:
ii  adduser                  3.110           add and remove users and groups
ii  libc6                    2.7-18          GNU C Library: Shared libraries
ii  libcap1                  1:1.10-14       support for getting/setting POSIX.
ii  libedit2                 2.11~20080614-1 BSD editline and history libraries
ii  libncurses5              5.7+20090124-1  shared libraries for terminal hand
ii  libssl0.9.8              0.9.8g-15       SSL shared libraries
ii  lsb-base                 3.2-20          Linux Standard Base 3.2 init scrip
ii  netbase                  4.34            Basic TCP/IP networking system

Versions of packages ntp recommends:
ii  perl                          5.10.0-19  Larry Wall's Practical Extraction 

Versions of packages ntp suggests:
pn  ntp-doc                       <none>     (no description available)

-- no debconf information


-- 
 .''`.   martin f. krafft <madduck at d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://lists.alioth.debian.org/pipermail/pkg-ntp-maintainers/attachments/20090206/4927525a/attachment.pgp 


More information about the pkg-ntp-maintainers mailing list