I am running a Debian GNU/Linux 8.7 box with Postfix 2.11.3-1 as MTA. All of a sudden, that is, with no change to the MTA setup, mails stopped being delivered, and the following error started showing up in /var/log/mail.err:
root@schroeder:~# tail /var/log/mail.err Mar 21 12:51:01 schroeder postfix/smtp[25421]: fatal: unknown service: smtp/tcp Mar 21 12:54:11 schroeder postfix/smtp[26397]: fatal: unknown service: smtp/tcp Mar 21 12:54:12 schroeder postfix/smtp[26398]: fatal: unknown service: smtp/tcp Mar 21 12:59:26 schroeder postfix/smtp[26553]: fatal: unknown service: smtp/tcp Mar 21 12:59:26 schroeder postfix/smtp[26554]: fatal: unknown service: smtp/tcp Mar 21 12:59:26 schroeder postfix/smtp[26555]: fatal: unknown service: smtp/tcp Mar 21 12:59:26 schroeder postfix/smtp[26556]: fatal: unknown service: smtp/tcp Mar 21 13:04:30 schroeder postfix/smtp[27797]: fatal: unknown service: smtp/tcp According to the Postfix documentation and two other similar questions on ServerFault, this is because postfix runs chrooted, but lacks the necessary files, presumably, /etc/services, in its spool directory, namely, /var/spool/postfix.
I checked and, indeed, /etc/services was missing from /var/spool/postfix. So I copied (not symlinked) /etc/services to /var/spool/postfix/etc. Alas, to no avail.
I then played around with disabling the chroot jail for postfix' smtp binary in /etc/postfix/master.cf and found that, when I disable chrooting for the unix service type, mail gets delivered normally. That is, the following /etc/postfix/master.cf works fine:
root@schroeder:~# grep -v ^# /etc/postfix/master.cf smtp inet n - - - - smtpd pickup unix n - - 60 1 pickup cleanup unix n - - - 0 cleanup qmgr unix n - n 300 1 qmgr tlsmgr unix - - - 1000? 1 tlsmgr rewrite unix - - - - - trivial-rewrite bounce unix - - - - 0 bounce defer unix - - - - 0 bounce trace unix - - - - 0 bounce verify unix - - - - 1 verify flush unix n - - 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap # The setting below is the one that I've changed. # The vendor default is a dash in the fifth column. smtp unix - - n - - smtp relay unix - - - - - smtp showq unix n - - - - showq error unix - - - - - error retry unix - - - - - error discard unix - - - - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} I figured that something else, that is, other than /etc/services not being present in the chroot jail at /var/spool/services, must be wrong with my chroot setup.
So I re-enabled chrooting, downloaded the Postfix source, checked the chroot setup script for Linux that ships with the Postfix source distribution and ran it:
root@schroeder:~# cd /usr/local/src/ root@schroeder:/usr/local/src# curl https://fourdots.com/mirror/postfix/postfix-release/official/postfix-3.2.0.tar.gz | tar -xz root@schroeder:/usr/local/src# sh postfix-3.2.0/examples/chroot-setup/LINUX2 postfix/postfix-script: refreshing the Postfix mail system Again, however, this did not fix my setup.
I also tried adding "-v" to the smtp configuration at /etc/postfix/master.cf, but the error reports didn't get more verbose.
At this point, I'm at my wits end. What else can I check? How can I fix my setup so that I can re-enable chrooting for postfix' smtp binary?
For reference, my setup:
root@schroeder:~# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix inet_interfaces = 127.0.0.1 ::1 mailbox_size_limit = 0 mydestination = schroeder.phl.univie.ac.at, localhost.phl.univie.ac.at, localhost myhostname = schroeder.phl.univie.ac.at mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_tls_cert_file = /etc/ssl/certs/phl.univie.ac.at.pem smtpd_tls_key_file = /etc/ssl/private/phl.univie.ac.at.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes Postfix is not (yet) protected by AppArmor:
root@schroeder:~# apparmor_status apparmor module is loaded. apparmor filesystem is not mounted. I checked whether this is a known bug on Postfix' homepage and Debian's bug tracker for the postfix package.
I also searched though the resources linked on the Postfix homepage and the mailing lists, but the only 'solution' I've found is to build Postfix from source. I gave that a try, too, but the error persisted.