Postfix – Mail system is down

postfix

My Postfix mail log keeps giving me this error;

Oct  4 10:32:50 postfix/master[9760]: daemon started -- version 2.9.6, configuration /etc/postfix
Oct  4 10:32:54 postfix/postqueue[9885]: warning: Mail system is down -- accessing queue directly

I also can't flush the queue in postfix due to this error.
postconf -n output:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = localhost
myhostname = host.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client.
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

My master.cf:

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
submission inet n       -       -       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATINGrelay   unix  -   -   n   -   -   smtp
flush     unix  n       -       n       1000?   0       flush
trace     unix  -   -   n   -   0   bounce
verify    unix  -   -   n   -   1   verify
proxymap  unix  -   -   n   -   -   proxymap
anvil     unix  -   -   n   -   1   anvil
scache    unix  -   -   n   -   1   scache
discard   unix  -   -   n   -   -   discard
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
retry     unix  -       -       n       -       -       error
proxywrite unix -       -       n       -       1       proxymap

it worked fine before with local users, but when I set up mysql virtual users it stopped working.

output of ps wwaux | grep postfix:

root     11298  0.0  0.0  25112  1644 ?        Ss   10:39   0:00 /usr/lib/postfix/master
postfix  11347  0.0  0.0  37820  2340 ?        S    10:41   0:00 tlsmgr -l -t unix -u
postfix  12194  0.0  0.0  59352  4476 ?        S    12:04   0:00 smtpd -n smtp -t inet -u -c -o stress=
postfix  12195  0.0  0.0  27176  1536 ?        S    12:04   0:00 proxymap -t unix -u
postfix  12196  0.0  0.0  27176  1528 ?        S    12:04   0:00 anvil -l -t unix -u
gage     12487  0.0  0.0   9388   928 pts/7    S+   12:05   0:00 grep --color=auto postfix

output of netstat:

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      11298/master
tcp        0      0 127.0.0.1:25465         0.0.0.0:*               LISTEN      2917/multicraft
tcp6       0      0 192.168.1.108:25569     :::*                    LISTEN      3791/java

Best Answer

Is postfix actually down? If you keep seeing messages about postfix master starting, then presumably it's also stopping in between? (whether it logs anything or not).

Are you running mailq? That would produce that warning about "Mail system is down".

If there's a problem with your virtual user setup, then you'd like to get some info on what's going on in the mysql queries. Maybe capture some DB traffic with tcpdump and run it through Percona's pt-query-digest and related tools. Or maybe just log all queries to the slow query log (ie threshold execution time = 0).