error while installing postfix

Hello i’m trying to configure a mail server with dovecot and postfix i’ve got the following error while installing postfix i have no clue on how to fix it i have searched for hours without getting success any clue?

thanks in advance!

root@mail:~# apt install postfix -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb mail-reader postfix-doc
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,152 kB of archives.
After this operation, 3,697 kB of additional disk space will be used.
Get:1 xenial-updates/main amd64 postfix amd64 3.1.0-3ubuntu0.3 [1,152 kB]
Fetched 1,152 kB in 0s (1,875 kB/s)
Preconfiguring packages ...
Selecting previously unselected package postfix.
(Reading database ... 132715 files and directories currently installed.)
Preparing to unpack .../postfix_3.1.0-3ubuntu0.3_amd64.deb ...
Unpacking postfix (3.1.0-3ubuntu0.3) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up postfix (3.1.0-3ubuntu0.3) ...
insserv: script postfix: service mail-transport-agent already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello friend!

I honestly cannot say that I have run into this before. Perhaps try this:

dpkg --purge postfix apt-get update && apt-get install postfix -y

Kind Regards, Jarland

This comment has been deleted