Dovecot - Auth process died too early - shutting down

29 Jun 2009

I upgraded a MySQL installation today and broke the dovecot POP/IMAP daemon. Fortunately, the fix wasn't too hard, and hopefully this will be useful to someone.

The MySQL upgrade was from 4.1 to 5.1, so it was a pretty big move. I compiled the new release, shut down the web server, dumped all the databases, removed the RPMs, installed the new version, restarted things and restored the databases. Things were pretty much working... although I had had to uninstall the old RPMs with rpm -e --nodeps since the dovecot POP3 daemon had MySQL as a dependency. But running ldd on /usr/sbin/dovecot showed no dependency on the MySQL client library, so I figured maybe that was just a spec file thing. Wrong!

I restarted dovecot and the process died leaving this in the log:

Jun 29 17:01:04 fiddle dovecot: Dovecot starting up
Jun 29 17:01:05 fiddle dovecot: Auth process died too early - shutting down
Jun 29 17:01:05 fiddle dovecot: child 6206 (auth) returned error 127

Not good. One of the dovecot options is to get passwords from a database. I use PAM, but dovecot still depended on MySQL. Blah!

Fortunately, the fix was pretty easy. I hunted down the source RPM, installed it with rpm -i dovecot-0.99.11-4.EL4.src.rpm, and edited /usr/src/redhat/SPECS/dovecot.spec. Here are the changes I made:

$ diff dovecot.spec.orig dovecot.spec
25,26d24
< BuildRequires: mysql-devel
< BuildRequires: postgresql-devel
68,69c66,67
<   --with-pgsql                 \
<   --with-mysql                 \
---
>   --without-pgsql                 \
>   --without-mysql                 \

7/30/09 update: Better yet, just set these options:

%define build_postgres 0
%define build_mysql 0

Then a quick build and install:

rpmbuild --ba /usr/src/redhat/SPECS/dovecot.spec
rpm -e dovecot
rpm -i /usr/src/redhat/RPMS/i386/dovecot-0.99.11-4.EL4.i386.rpm

And edit /etc/dovecot.conf:

$ diff /etc/dovecot.conf.rpm.orig /etc/dovecot.conf
14a15
> protocols = imap imaps pop3 pop3s
197a199
> default_mail_env = mbox:/var/spool/mail/%u

Enable dovecot to start on boot with /sbin/chkconfig --level 345 dovecot on and you're back in business. Hope this helps someone!

Incidentally, if you need a Postfix book, try The Book of Postfix: State-of-the-Art Message Transport by Ralf Hildebrandt and Patrick Koetter. It's a few years old but still very relevant... and of course Postfix is a great mail server. Enjoy!