POSTFIX Won't Start says: bind 0.0.0.0 port 25: Address already in use, what should i do?

I followed the tutorial here: https://help.ubuntu.com/community/PostfixCompleteVirtualMailSystemHowto#Create_a_vmail_user to set up Postfix on a new ubuntu installation but it won't start, whenever i try to start it with postfix start say: fatal: mail system startup failed

here is my error log: SYSERR(root): collect: Cannot write ./dfr2IIHHJB029721 (bfcommit, uid=0, gid=125): No such file or directory

and fatal: bind 0.0.0.0 port 25: Address already in use And smtp is running on port 25, i checked. Please what should i do? I need to get this mail server up and runnning


Solution 1:

See what's got that port open. In Linux:

$ sudo netstat -lnp |grep :25

You will see something like:

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1624/master     
tcp6       0      0 :::25                   :::*                    LISTEN      1624/master  

In this case, 1624 is the process id (pid). So:

$ ps aux |grep 1624

root 1624 0.0 0.0 25160 1636 ? Ss Jul17 0:00 /usr/lib/postfix/master

You can kill or restart that process (or decide, heh, it's already running....).

Solution 2:

Normally, Postfix automatically disables Sendmail when it is installed. Sendmail is also a mail server, so there can't be two of them handling your emails on the same port.

Since Postfix automatically provides a sendmail compatibility program, your system and your users (eg. mail PHP function) can continue to call it, but you don't need the sendmail MTA anymore, since Postfix will do its job now.

I recommend you uninstall the Sendmail MTA to avoid problems :

apt-get remove sendmail

If you want to make sure which sendmail command do you have (the Postfix one, or the true sendmail), you can use following command:

user@linux:~# ldd /usr/sbin/sendmail
...
libpostfix-global.so.1 => /usr/lib/libpostfix-global.so.1 (0x00007f890e1b1000)
libpostfix-util.so.1 => /usr/lib/libpostfix-util.so.1 (0x00007f890df7b000)
...

If you see something like libpostfix, then you have the right sendmail program installed.