Purging smtp services from Debian

Lately I purchased mew dedicated server with intention to use it as my new running mail email server – mailcow, my blog, and some other services. When I was migrating mailcow suite everything was fine except postfix image failed to start.

I had problem like that already on Debian and usually I was dealing with that by disabling exim:

sudo systemctl disable exim.service

This was fine till major Debian update that was reinstalling exim and causing it to steal port 25 again. So this time I decided to uinstall it completely.

sudo apt remove exim4-daemon-light

This removed exim but mailcow again failed to start! To my surprise inspecting open ports shown that port 25 is being used again. This time it was service called couriertcpd. I decided to get rid of this one too, though I had to first search for the name of the package.

sudo apt remove courier-mta

And after that I did again discover that port 25 is busy again! This time exim was back!

Well I had only myself to blame since I was accepting what apt was proposing to do without actually reading the proposition of changes. Every remove of one smtp package was coming up with yet another alternative to deliver emails.

I understand that it is baked into the system that it needs local mail server for some administration purposes, but installing packages during removal is for me a bit too much.

I started to do

sudo apt purge exim4-* courier-*

and it kept with yet another and another alternative:

  • dma
  • estmp
  • mstmp
  • nullmailer
  • opensmtpd
  • postfix
  • sendmail-cf
  • ssmtp

So doing:

sudo apt purge exim4-* courier-* dma esmtp msmtp nullmailer opensmtpd postfix sendmail-cf ssmtp

finally removed all SMTP services that could steal port 25 from mailcow.

After doing small cleanup

sudo apt autoremove

that removed all unnecessary dependencies that were installed with purged mail services, I finally had free 25 port and mailcow was able to start.

Leave a Reply

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

Solve : *
3 + 24 =