Problem using Postfix with Sendmail

42,986

Solution 1

Postfix is a drop-in sendmail replacement that includes its own sendmail binary (see the foot of this post). I'm honestly surprised apt let you do this, I thought they were package conflicted.

Anyway, to fix:

sudo apt-get purge sendmail
sudo apt-get install --reinstall postfix
sudo /etc/init.d/postfix restart

Proof that sendmail on my system is provided by postfix:

$ dpkg -S `which sendmail`
postfix: /usr/sbin/sendmail

If you're still having problems, here's how you can find out what program (and which package) is hogging port 25:

$ sudo netstat -pel | grep smtp
tcp 0 0 *:smtp *:* LISTEN root 8487 2212/master

$ # Then we use the 2212 from that in the following to get the package:
$ dpkg -S "$(sudo ps ux | grep 2212 | awk '{print $NF}')"
postfix: /usr/lib/postfix/master

In my case that's postfix. In your case I expect to see something else. Nuke it from orbit.

Solution 2

For me the solituion was a variant of Oli answer in an Ubuntu13:

Error: fatal: bind 0.0.0.0 port 25: Address already in use

Sendmail purge didn't work:

Package 'sendmail' is not installed, so not removed

So I tried:

service sendmail stop
sudo apt-get install --reinstall postfix

and worked!

Solution 3

This solved me on the same issue.

service sendmail stop
service postfix restart
service sendmail start

As seen at Postfix start error Port 25: Address already in use

Share:
42,986

Related videos on Youtube

Chock CHin Li
Author by

Chock CHin Li

Updated on September 18, 2022

Comments

  • Chock CHin Li
    Chock CHin Li almost 2 years

    I've sendmail installed using "apt-get install sendmail" and also postfix installed using Webmin. But Postfix cannot start, and when I checked the /var/log/mail.err

    *Jul 11 14:09:03 victoria postfix/master[6588]: fatal: bind 0.0.0.0 port 25: Address already in use
    Jul 11 14:09:10 victoria postfix/master[6821]: fatal: bind 0.0.0.0 port 25: Address already in use
    Jul 11 14:09:11 victoria postfix/master[6820]: fatal: daemon initialization failure
    Jul 11 14:09:12 victoria postfix/postfix-script[6822]: fatal: mail system startup failed*
    

    and my "netstat -tap" show:

    *root@victoria:/etc/init.d# netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 localhost:mysql         *:*                     LISTEN      2365/mysqld     
    tcp        0      0 localhost:submission    *:*                     LISTEN      5639/sendmail: MTA:
    tcp        0      0 *:webmin                *:*                     LISTEN      896/perl        
    tcp        0      0 *:ssh                   *:*                     LISTEN      554/sshd        
    tcp        0      0 localhost:smtp          *:*                     LISTEN      5639/sendmail: MTA:
    tcp        0    384 192.241.205.208:ssh     175.139.222.195:45062   ESTABLISHED 29460/1         
    tcp6       0      0 [::]:http               [::]:*                  LISTEN      773/apache2     
    tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      554/sshd        
    getnameinfo failed
    getnameinfo failed
    tcp6       0      1 [UNKNOWN]:http          [UNKNOWN]:60003         LAST_ACK    -*   
    

    disable Sendmail can get the Postfix up and running. But I thought sendmail and postfix are suppose to work together? How to configure to have them both in a server?

    Thanks.

    • Admin
      Admin about 9 years
      Could you tell me what would cause this? sendmail.postfix: fatal: [email protected](3301): No recipient addresses found in message header
  • Chock CHin Li
    Chock CHin Li almost 11 years
    Hi, thanks for your help. I have follow your instruction, but still getting the same error =========================================================== Jul 11 19:10:59 victoria postfix/master[15150]: fatal: bind 0.0.0.0 port 25: Address already in use Jul 11 19:11:48 victoria postfix/master[15432]: fatal: bind 0.0.0.0 port 25: Address already in use Jul 11 19:11:49 victoria postfix/master[15431]: fatal: daemon initialization failure Jul 11 19:11:50 victoria postfix/postfix-script[15433]: fatal: mail system startup failed Any idea? maybe is not the sendmail this time?
  • Oli
    Oli almost 11 years
    @ChockCHinLi Added a bit to the end to help you work out what's going on.
  • Chock CHin Li
    Chock CHin Li almost 11 years
    hey, thanks for your help. I restart my server and the postfix is started and no more error from the log! Thanks!
  • Chris1804505
    Chris1804505 about 10 years
    sudo service postfix stop did the trick for me. Then a sudo /etc/init.d/postfix reload succeeded.
  • Janaka R Rajapaksha
    Janaka R Rajapaksha about 7 years
    if it says Package 'sendmail' is not installed, so not removed, you should run sudo apt-get purge sendmail*