Package: postfix
Version: 3.1.4-4
X-Debbugs-Cc: probl...@cip.cs.fau.de
Tags: patch

hi,


when i install postfix to a freshly installed (with our custom
debootstrap+saltstack process, but as far as i can tell that doesn't
make a difference here), the postinst script fails to start because the
"posfix" user doesn't exist on the system yet:

# apt install postfix
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libcdb-dev libcdb1 liblmdb-dev libsasl2-dev linux-image-amd64
Use 'apt autoremove' to remove them.
Suggested packages:
  postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb sasl2-bin 
dovecot-common resolvconf postfix-cdb ufw postfix-doc
The following NEW packages will be installed:
  postfix
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,435 kB of archives.
After this operation, 4,010 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package postfix.
(Reading database ... 918427 files and directories currently installed.)
Preparing to unpack .../postfix_3.1.4-4_amd64.deb ...
Unpacking postfix (3.1.4-4) ...
Processing triggers for systemd (232-15) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for rsyslog (8.24.0-1) ...
Setting up postfix (3.1.4-4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → 
/etc/systemd/system/postfix.service.
Job for postfix.service failed because the control process exited with error 
code.
See "systemctl status postfix.service" and "journalctl -xe" for details.
invoke-rc.d: initscript postfix, action "start" failed.
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/etc/systemd/system/postfix.service; enabled; vendor preset: 
enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2017-02-06 
03:25:57 CET; 7ms ago
  Process: 16928 ExecStart=/usr/sbin/postfix start (code=exited, 
status=1/FAILURE)
  Process: 16924 ExecStartPre=/bin/cp /etc/services 
/var/spool/postfix/etc/services (code=exited, status=0/SUCCESS)
  Process: 16916 ExecStartPre=/bin/cp /etc/resolv.conf 
/var/spool/postfix/etc/resolv.conf (code=exited, status=0/SUCCESS)

Feb 06 03:25:57 faui03m systemd[1]: Failed to start Postfix Mail Transport 
Agent.
Feb 06 03:25:57 faui03m systemd[1]: postfix.service: Unit entered failed state.
Feb 06 03:25:57 faui03m systemd[1]: postfix.service: Failed with result 
'exit-code'.
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (232-15) ...
Processing triggers for rsyslog (8.24.0-1) ...
Errors were encountered while processing:
 postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)


# getent passwd postfix
# getent group postfix



steps to reproduce: debootstrap stretch; install postfix
expected outcome: postfix creating appropriate users+cfg files
actual outcome: postfix fails in postinst before creating user/group

the problem seems to be that the "#DEBHELPER#" magic inserted at line
200f. of postfix.postinst contains the following snippet:


# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
        if [ -x "/etc/init.d/postfix" ]; then
                update-rc.d postfix defaults >/dev/null
                invoke-rc.d postfix start || exit $?
        fi
fi
# End automatically added section

which tries to start the postfix daemon before all the config setup is
finished.

the attached patch moves the "#DEBHELPER#" line all the way to the
bottom of postfix.postinst, which does fix the problem for us, but i'm
not certain enough to understand the .postinst and especially the
debhelper magic to know this simple fix doesn't introduce new problems.



regards,
   johannes schilling
diff --git a/postfix.postinst b/postfix.postinst
index b413a50..43f4500 100644
--- a/postfix.postinst
+++ b/postfix.postinst
@@ -197,8 +197,6 @@ umask 022
 
 # postinst processing
 
-#DEBHELPER#
-
 case "$1" in
     configure)
        OLDVERSION="$2"
@@ -674,3 +672,5 @@ if [ "$mailer" != "No configuration" ] || [ -f /etc/postfix/main.cf ]; then
        fi
     fi
 fi
+
+#DEBHELPER#

Reply via email to