I recently updated a development server running CentOS and ran into various minor issues including one regarding postfix being compiled with MySQL support. The development server runs ISPConfig for various virtual hosts and after upgrading all the packages on the server which included Postfix I noticed errors in the maillog. Below I describe what the error was in more detail as well as how it can easily be resolved.
Postfix maillog Errors:
- Jan 11 16:07:23 dev postfix/master[25925]: warning: /usr/libexec/postfix/qmgr: bad command startup -- throttling
- Jan 11 16:08:09 dev sendmail[21910]: p0BM89ve021910: Authentication-Warning: dev.example.com: apache set sender to webmaster@example.com using -f
- Jan 11 16:08:09 dev sendmail[21910]: p0BM89ve021910: from=webmaster@example.com, size=1299, class=0, nrcpts=1, msgid=<d6509fcebe617ce108ab2763ba7ca999@www.example.com>, relay=apache@localhost
- Jan 11 16:08:22 dev postfix/smtpd[21944]: fatal: unsupported dictionary type: mysql
- Jan 11 16:08:23 dev postfix/qmgr[21948]: fatal: unsupported dictionary type: mysql
- Jan 11 16:08:23 dev postfix/master[25925]: warning: process /usr/libexec/postfix/smtpd pid 21944 exit status 1
- Jan 11 16:08:23 dev postfix/master[25925]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
- Jan 11 16:08:24 dev postfix/master[25925]: warning: process /usr/libexec/postfix/qmgr pid 21948 exit status 1
- Jan 11 16:08:24 dev postfix/master[25925]: warning: /usr/libexec/postfix/qmgr: bad command startup -- throttling
As you can see there are numerous errors in the maillog, which is located in the /var/log directory on CentOS Linux, which point to multiple issues. The primary issue is the fact that Postfix was not compiled with MySQL support as it is not included in the default packages on CentOS Linux. To resolve this error follow the directions below.
Resolve Postfix Error: fatal: unsupported dictionary type: mysql
- Download Latest PostgreSQL Source RPM: Visit this URL to search for the latest PostgreSQL source RPM package as shown in the below example. Once installed you can build a custom PostgreSQL RPM with MySQL support.
- [root@dev src]# wget http://www.gtlib.gatech.edu/pub/centos/5.5/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm
- --2011-01-11 16:11:46-- http://www.gtlib.gatech.edu/pub/centos/5.5/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm
- Resolving www.gtlib.gatech.edu... 128.61.111.9, 128.61.111.10, 128.61.111.11, ...
- Connecting to www.gtlib.gatech.edu|128.61.111.9|:80... connected.
- HTTP request sent, awaiting response... 200 OK
- Length: 2865338 (2.7M) [application/x-rpm]
- Saving to: `postfix-2.3.3-2.1.el5_2.src.rpm'
- 100%[==========================================================================================>] 2,865,338 1.94M/s in 1.4s
- 2011-01-11 16:11:48 (1.94 MB/s) - `postfix-2.3.3-2.1.el5_2.src.rpm' saved [2865338/2865338]
- [root@dev src]#
- Stop Postfix Mail Server: Now stop Postfix using syntax similar to the below example syntax.
- [root@dev src]# /etc/init.d/postfix stop
- Shutting down postfix: [ OK ]
- [root@dev src]#
- Remove Postfix RPM: After stopping Postfix in step two you should remove it from the server using the –nodeps switch so anything that depends on this package stays installed as we will be installing a new Postfix RPM once we build in MySQL support.
- [root@dev src]# rpm -e --nodeps postfix
- warning: /usr/lib/sasl2/smtpd.conf saved as /usr/lib/sasl2/smtpd.conf.rpmsave
- warning: /etc/postfix/master.cf saved as /etc/postfix/master.cf.rpmsave
- warning: /etc/postfix/main.cf saved as /etc/postfix/main.cf.rpmsave
- [root@dev src]#
If you have made any changes to the Postfix configuration files a copy will be saved as noted in the output when the package is removed.
- Install Postfix Source RPM: Now install the Postfix SRPM package using syntax similar to the below.
- yum localinstall postfix-2.3.3-2.1.el5_2.src.rpm
- Install Necessary RPM’s: After installing the Postfix SRPM install both the mysql-devel package and pcre-devel package as shown in the below example syntax.
- [root@dev SPECS]# yum install pcre-devel mysql-devel
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- * addons: mirror.team-cymru.org
- * atomic: www4.atomicorp.com
- * base: centos.mirror.netriplex.com
- * epel: mirror.hiwaay.net
- * extras: yum.singlehop.com
- * rpmforge: ftp-stud.fht-esslingen.de
- * updates: mirrors.netdna.com
- addons | 951 B 00:00
- base | 2.1 kB 00:00
- epel | 3.7 kB 00:00
- epel/primary_db | 2.9 MB 00:00
- extras | 2.1 kB 00:00
- updates | 1.9 kB 00:00
- Setting up Install Process
- Package pcre-devel-6.6-2.el5_1.7.i386 already installed and latest version
- Package matching mysql-devel-5.1.54-1.el5.art.i386 already installed. Checking for update.
- Nothing to do
- [root@dev SPECS]#
- Edit postfix.spec File: Now lets edit the postfix.spec file located in /usr/src/redhat/SPECS/ directory with your favorite text editor. In the below example outputs, which include both a before and a after postfix.spec snip, you can see that we changed the 0 after mysql to a 1.
postfix.spec: Before Edit
- %define LDAP 2
- %define MYSQL 0
- %define PCRE 1
- %define SASL 2
- %define TLS 1
- %define IPV6 1
- %define POSTDROP_GID 90
- %define PFLOGSUMM 1
postfix.spec: After Edit
- %define LDAP 2
- %define MYSQL 1
- %define PCRE 1
- %define SASL 2
- %define TLS 1
- %define IPV6 1
- %define POSTDROP_GID 90
- %define PFLOGSUMM 1
Please note that the examples above are only a small snip from the postfix.spec file.
- Run rpmbuild Against postfix.spec: If you don’t already have rpmbuild installed then install it via yum using yntax similar to “yum install rpmbuild”. Once installed run the below command on the postfix.spec file that was just edited as shown in the below example.
- [root@dev SPECS]# rpmbuild -ba postfix.spec
- ...................
- ...................
- Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/postfix-buildroot
- Wrote: /usr/src/redhat/SRPMS/postfix-2.3.3-2.1.src.rpm
- Wrote: /usr/src/redhat/RPMS/i386/postfix-2.3.3-2.1.i386.rpm
- Wrote: /usr/src/redhat/RPMS/i386/postfix-pflogsumm-2.3.3-2.1.i386.rpm
- Wrote: /usr/src/redhat/RPMS/i386/postfix-debuginfo-2.3.3-2.1.i386.rpm
- Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.27287
- + umask 022
- + cd /usr/src/redhat/BUILD
- + cd postfix-2.3.3
- + /bin/rm -rf /var/tmp/postfix-buildroot
- + exit 0
- [root@dev SPECS]#
The output above is on the last couple of lines that were output after entering the rpmbuild command listed in the output above. You will likely see lots and lots of errors while the RPM build is occurring but they can be ignored for now.
- Install New Postfix RPM Created: Now you can install the RPM that was created using the rpmbuild command above which is located in the /usr/src/redhat/RPMS/i386 directory.
- [root@dev i386]# rpm -i postfix-2.3.3-2.1.i386.rpm
If your preference is to install via the yum package manager then you can use syntax similar to “yum localinstall postfix-2.3.3-2.1.i386.rpm”.
- Start Postfix Mail Server: Once the RPM is installed merge in the previous Postfix configurations from the files that were backed up automatically earlier and then start Postfix using syntax similar to the below example output.
- [root@dev SPECS]# /etc/init.d/postfix start
- Starting postfix: [ OK ]
- [root@dev SPECS]#
- Verify Mail Working: Once Postfix has been started you should verify mail is working using a command similar to the below output while viewing the maillog as shown below.
- [root@dev SPECS]# less postfix.spec | mail alex@example.com
- [root@dev SPECS]# tail -f /var/log/maillog
- Jan 11 16:22:44 dev postfix/master[29930]: daemon started -- version 2.3.3, configuration /etc/postfix
- Jan 11 16:22:46 dev sendmail[29938]: p0BMMksU029938: from=root, size=30902, class=0, nrcpts=1, msgid=<201101112222.p0BMMksU029938@dev.example.com>, relay=root@localhost
- Jan 11 16:22:46 dev postfix/smtpd[29939]: connect from localhost.localdomain[127.0.0.1]
- Jan 11 16:22:46 dev postfix/smtpd[29939]: 821A221A830F: client=localhost.localdomain[127.0.0.1]
- Jan 11 16:22:46 dev postfix/cleanup[29942]: 821A221A830F: message-id=<201101112222.p0BMMksU029938@dev.example.com>
- Jan 11 16:22:46 dev postfix/qmgr[29933]: 821A221A830F: from=<root@dev.example.com>, size=32243, nrcpt=1 (queue active)
- Jan 11 16:22:46 dev sendmail[29938]: p0BMMksU029938: to=alex@example.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60902, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 821A221A830F)
- Jan 11 16:22:46 dev postfix/smtpd[29939]: disconnect from localhost.localdomain[127.0.0.1]
- Jan 11 16:22:47 dev postfix/smtp[29943]: 821A221A830F: to=<alex@example.com>, relay=aspmx.l.google.com[74.125.47.27]:25, delay=1.3, delays=0.06/0.01/0.24/0.97, dsn=2.0.0, status=sent (250 2.0.0 OK 1294784575 14si58114070yhl.145)
- Jan 11 16:22:47 dev postfix/qmgr[29933]: 821A221A830F: removed
Postfix should now be operational on your Linux server without any issues.
Thanks for the description in detail!! It’s work!!
Now I can keep fixing the other problem~~
Hello poca,
No problem. Thanks for taking the time to leave feedback.
Thanks.
alex