Fixing problems with Dovecot – Postfix mail server after Ubuntu server upgrade to 11.10

Standard

The thing that scares me most about server upgrades is the mail server… the thought of having to reconfigure the many interdependent servers and processes involved is horrible.

So I wasn’t pleased to find my postfix-dovecot installation dying on upgrade from 11.04 to 11.10. I couldn’t sent outgoing mail or receive inbound.

Fortunately I wasn’t an “early upgrader”… both issues were easy to find and fix.

Fixing inbound mail

Messages sent to my address were being returned as undeliverable with the following error:

            < my-server.com #5.3.0 x-unix; /usr/lib/dovecot/deliver: invalid option -- 'n' Usage:    dovecot-lda [-c ] [-a 
] [-d ] [-p ] [-f ] [-m ] [-e] [-k]>


This is fairly self-explanatory: In the new version of Dovecot, the “n” option is no longer used. If you receive this error, type the following commands:

sudo postconf -e "mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -m \"\${EXTENSION}\""
sudo service postfix restart 

Done.

Fixing outbound mail

My errors were caused by the SASL authentication server, saslauthd. A bug report is here.

The problem can be fixed by rolling back saslauthd packages to a previous version, then “sticking” them so that they don’t get updated with regular system updates. Keep track of this so that you can remember to un-stick them when it comes time to upgrade.

First get the old packages. Replace “i386″ in the links below with “amd64″ if your server is 64-bit

mkdir ~/saslfixes
cd ~/saslfixes
wget http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-2_2.1.23.dfsg1-5ubuntu3_i386.deb http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-modules_2.1.23.dfsg1-5ubuntu3_i386.deb http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-dev_2.1.23.dfsg1-5ubuntu3_i386.deb http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-modules-sql_2.1.23.dfsg1-5ubuntu3_i386.deb http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/sasl2-bin_2.1.23.dfsg1-5ubuntu3_i386.deb

Then remove the old packages and install the new ones:

sudo /etc/init.d/saslauthd stop
sudo dpkg -r libsasl2-dev
sudo dpkg -r libsasl2-modules-sql
sudo dpkg -r sasl2-bin
sudo dpkg -r --force-all libsasl2-2 libsasl2-2:i386
sudo dpkg -r --force-all libsasl2-modules
sudo dpkg -i --force-all *.deb

Then restart the servers:

sudo /etc/init.d/saslauthd restart
sudo /etc/init.d/postfix restart

And finally “stick” the packages so they aren’t updated:

Type these commands as root (sudo su - will get you a root shell)

echo libsasl2-dev hold | dpkg --set-selections
echo libsasl2-modules-sql hold | dpkg --set-selections
echo libsasl2-2 hold | dpkg --set-selections
echo libsasl2-modules hold | dpkg --set-selections
echo sasl2-bin hold | dpkg --set-selections

2 thoughts on “Fixing problems with Dovecot – Postfix mail server after Ubuntu server upgrade to 11.10

  1. Hey John no contact page? I could not find a way to email you so I guess I will ask here even thou it has zero to do with the post. Who the hell is black dev or what ever there called? Dont give out your ftp man or did they hack you? I was just about to go get a copy of it. Luckly I found a OCT 2010 copy but what happen? If you need any help let me know.

  2. Oh Lord have mercy, I’ve went through many sleepless nights configuring Dovecot, Postfix, Mariadb and connected it with Nodemailer/NodeJS. All worth it in the end though and was quite rewarding and fun finally figuring it all out.

    tail -f /var/log/mail.log and tail -f /var/log/mail.err are your friends!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>