Postfix not sending mails after installing and uninstalling Sendmail

I got bitten today, really bad! My story starts when postfix stopped working for me (after the update last night). All I had to do was re-install postfix but in desperation I ended up installing Sendmail and that’s how it all started! I found my mistake, uninstalling Sendmail and then reinstalled Postfix. But it was too late. Now the server wasn’t sending emails. I quickly jumped to /var/log/mail.log which read:

postfix/master: fatal: bind 0.0.0.0 port 25: Address already in use

A big of Googling to see what was using port 25, I had to install sockstat as it gives you the process ID of the process running on that port:

socket | grep :25

The output I got was very interesting:

root     sendmail-mta    17059    tcp4    127.0.0.1:25     *:*    LISTEN

Aha! I thought I had uninstalled Sendmail! Well I have, but the process is still running(!) and holding the port 25 at bay!

A quick kill command:

kill 17059

(replace the number with the process id you got in the previous command)

Give Postfix a reboot and viola! It works!

If this works for you, please leave a comment 🙂

Flattr this!