Package: courier-mta
Version: 0.73.1-1.6
Severity: important
Tags: patch

Dear Maintainer,

After a Debian upgrade, I found that the courier-mta daemon was
not running - it had not been started at boot time.  Re-running
the init script manually started it OK.  The same scenario occurred
after each subsequent shutdown / reboot of the system - no daemon
even though its init file was present (and symlinked from /etc/rc2.d)
but running the init script manually would always start the daemon
correctly.

I hooked up a serial console to the server and captured the boot log.
Observed that courier-mta was complaining about the inability to write
into one of its temporary directories and the init script was
aborting part way through.

I checked the Courier init scripts, and observed that the courier
"run" directory is set up by the courier-authdaemon init script.
and then used by courier-mta and courier-mta-ssl.  If the authdaemon
script doesn't run to completion before the courier-mta script, a
race condition occurs, and courier-mta may abort because the setup
hasn't been done.

In the older sysv init system this was not a problem, as the init
scripts are run in alphabetic order in any given dependency group.
Because -authdaemon sorts before -mta, proper setup occurred.

This is no longer the case, in the newer init systems which run
multiple scripts (or start multiple services) in parallel.  The
implicit alphabetic ordering no longer applies.

The courier-mta init script does not list courier-authdaemon as a
dependency, even though this script does require that some of the
setup logic in courier-authdaemon be run first.  Thus, the two scripts
are in the ordering level and can run at the same time (or in an
arbitrary order).  This leaves courier-mta vulnerable to a failed
startup.

I added "courier-authdaemon" to the courier-mta and courier-mta-ssl
service requirement lines, and re-ran "insserv".  This moved these
two init scripts to the next-highest ordering group, ensuring that
courier-authdaemon would start up first.
     
courier-mta started up reliably, at every subsequent boot, until
the next time a system upgrade replaced the courier-mta init script.
   
I suggest adding these dependency lines to the startup scripts
for the next release.

Patch is attached below.

-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages courier-mta depends on:
ii  courier-authlib        0.66.1-1+b1
ii  courier-base           0.73.1-1.6
ii  debconf [debconf-2.0]  1.5.56
ii  libc6                  2.19-18
ii  libgcc1                1:4.9.2-10
ii  libgdbm3               1.8.3-13.1
ii  libnet-cidr-perl       0.17-1
ii  libperl5.20            5.20.2-3+deb8u1
ii  libstdc++6             4.9.2-10

courier-mta recommends no packages.

Versions of packages courier-mta suggests:
ii  bsd-mailx [mail-reader]    8.1.2-0.20141216cvs-2
ii  courier-doc                0.73.1-1.6
pn  courier-filter-perl        <none>
pn  couriergrey                <none>
ii  emacs23-nox [mail-reader]  23.4+1-4
ii  jed [mail-reader]          1:0.99.19-3
ii  mutt [mail-reader]         1.5.23-3

-- Configuration Files:
/etc/courier/aliases/system [Errno 13] Permission denied: 
u'/etc/courier/aliases/system'
/etc/courier/courierd changed [not included]
/etc/courier/esmtpauthclient [Errno 13] Permission denied: 
u'/etc/courier/esmtpauthclient'
/etc/courier/esmtpd changed [not included]
/etc/courier/module.esmtp changed [not included]
/etc/courier/rfcerr2045.txt 837c13d2605ce11fdda9ab0938215ff3 [Errno 2] No such 
file or directory: u'/etc/courier/rfcerr2045.txt 
837c13d2605ce11fdda9ab0938215ff3'
/etc/courier/rfcerr2046.txt 5faa78ef43fcc1e55ad2d1f9e583517b [Errno 2] No such 
file or directory: u'/etc/courier/rfcerr2046.txt 
5faa78ef43fcc1e55ad2d1f9e583517b'
/etc/courier/rfcerr2047.txt b894a308ec01c0c91cf2afa3a3ff1219 [Errno 2] No such 
file or directory: u'/etc/courier/rfcerr2047.txt 
b894a308ec01c0c91cf2afa3a3ff1219'
/etc/courier/rfcerrheader.txt 7689371800e5896210ac5568d6d471a8 [Errno 2] No 
such file or directory: u'/etc/courier/rfcerrheader.txt 
7689371800e5896210ac5568d6d471a8'
/etc/courier/smtpaccess/default changed [not included]
/etc/init.d/courier-mta changed [not included]

-- debconf information:
  courier-mta/dsnfrom: mailer-dae...@snulbug.mtview.ca.us
  courier-mta/defaultdomain: snulbug.mtview.ca.us

diff -r -u courier-0.73.1/debian/courier-imap.init 
courier-0.73.1-initfix/debian/courier-imap.init
--- courier-0.73.1/debian/courier-imap.init     2015-08-13 20:11:53.000000000 
-0700
+++ courier-0.73.1-initfix/debian/courier-imap.init     2015-08-13 
20:16:43.828156759 -0700
@@ -2,8 +2,8 @@
 ### BEGIN INIT INFO
 # Short-Description: Courier IMAP server
 # Provides:          courier-imap
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
+# Required-Start:    $remote_fs $syslog courier-authdaemon
+# Required-Stop:     $remote_fs $syslog courier-authdaemon
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 ### END INIT INFO
diff -r -u courier-0.73.1/debian/courier-mta.init 
courier-0.73.1-initfix/debian/courier-mta.init
--- courier-0.73.1/debian/courier-mta.init      2015-08-13 20:11:53.000000000 
-0700
+++ courier-0.73.1-initfix/debian/courier-mta.init      2015-08-13 
20:15:27.241688552 -0700
@@ -2,8 +2,8 @@
 ### BEGIN INIT INFO
 # Short-Description: Courier SMTP server
 # Provides:          courier-mta
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
+# Required-Start:    $remote_fs $syslog courier-authdaemon
+# Required-Stop:     $remote_fs $syslog courier-authdaemon
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 ### END INIT INFO
diff -r -u courier-0.73.1/debian/courier-mta-ssl.init 
courier-0.73.1-initfix/debian/courier-mta-ssl.init
--- courier-0.73.1/debian/courier-mta-ssl.init  2015-08-13 20:11:53.000000000 
-0700
+++ courier-0.73.1-initfix/debian/courier-mta-ssl.init  2015-08-13 
20:16:00.742796446 -0700
@@ -2,8 +2,8 @@
 ### BEGIN INIT INFO
 # Short-Description: Courier SMTP server
 # Provides:          courier-mta-ssl
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
+# Required-Start:    $remote_fs $syslog courier-authdaemon
+# Required-Stop:     $remote_fs $syslog courier-authdaemon
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 ### END INIT INFO

Reply via email to