Exim4 Failed to start

Exim4 unable to start even after rebooting server:

× exim4.service - LSB: exim Mail Transport Agent
     Loaded: loaded (/etc/init.d/exim4; generated)
     Active: failed (Result: exit-code) since Sun 2024-06-16 01:48:52 UTC; 3min 35s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 29906 ExecStart=/etc/init.d/exim4 start (code=exited, status=1/FAILURE)
        CPU: 147ms

Jun 16 01:48:52 server.hostname.com systemd[1]: Starting LSB: exim Mail Transport Agent...
Jun 16 01:48:52 server.hostname.com exim4[29906]:  * Starting MTA
Jun 16 01:48:52 server.hostname.com exim4[30149]: 2024-06-16 01:48:52 Exim configuration error in line 41 of /var/lib/exim4/config.autogenerated.tmp:
Jun 16 01:48:52 server.hostname.com exim4[30149]:   main option "acl_smtp_mime" unknown
Jun 16 01:48:52 server.hostname.com exim4[30151]: Invalid new configfile /var/lib/exim4/config.autogenerated.tmp, not installing
Jun 16 01:48:52 server.hostname.com exim4[30151]: /var/lib/exim4/config.autogenerated.tmp to /var/lib/exim4/config.autogenerated
Jun 16 01:48:52 server.hostname.com systemd[1]: exim4.service: Control process exited, code=exited, status=1/FAILURE
Jun 16 01:48:52 server.hostname.com systemd[1]: exim4.service: Failed with result 'exit-code'.
Jun 16 01:48:52 server.hostname.com systemd[1]: Failed to start LSB: exim Mail Transport Agent.

Did you modify /etc/exim4/exim4.conf.template?

Show the output of these commands:

ls -l /etc/exim4/exim4.conf.template
grep -E -B5 -A4 'acl_smtp_mime|acl_check_mime' /etc/exim4/exim4.conf.template
root@server2:~# ls -l /etc/exim4/exim4.conf.template
-rw-r----- 1 root root 18786 Nov 17  2023 /etc/exim4/exim4.conf.template
root@server2:~# grep -E -B5 -A4 'acl_smtp_mime|acl_check_mime' /etc/exim4/exim4.conf.template
untrusted_set_sender = *
acl_smtp_connect = acl_check_spammers
acl_smtp_mail = acl_check_mail
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
acl_smtp_mime = acl_check_mime

.ifdef SPAMASSASSIN
spamd_address = 127.0.0.1 783
.endif
--
.endif

  accept


acl_check_mime:
  deny   message        = Blacklisted file extension detected
         condition      = ${if match {${lc:$mime_filename}}{\N(\.ace|\.ade|\.adp|\.app|\.arj|\.asp|\.aspx|\.asx|\.bas|\.bat|\.cab|\.cer|\.chm|\.cmd|\.cnt|\.com|\.cpl|\.crt|\.csh|\.der|\.diagcab|\.dll|\.efi|\.exe|\.fla|\.fon|\.fxp|\.gadget|\.grp|\.hlp|\.hpj|\.hta|\.htc|\.img|\.inf|\.ins|\.iso|\.isp|\.its|\.jar|\.jnlp|\.js|\.jse|\.ksh|\.lib|\.lnk|\.mad|\.maf|\.mag|\.mam|\.maq|\.mar|\.mas|\.mat|\.mau|\.mav|\.maw|\.mcf|\.mda|\.mdb|\.mde|\.mdt|\.mdw|\.mdz|\.msc|\.msh|\.msh1|\.msh1xml|\.msh2|\.msh2xml|\.mshxml|\.msi|\.msp|\.mst|\.msu|\.ops|\.osd|\.pcd|\.pif|\.pl|\.plg|\.prf|\.prg|\.printerexport|\.ps1|\.ps1xml|\.ps2|\.ps2xml|\.psc1|\.psc2|\.psd1|\.psdm1|\.pst|\.py|\.pyc|\.pyo|\.pyw|\.pyz|\.pyzw|\.reg|\.scf|\.scr|\.sct|\.sfx|\.shb|\.shs|\.swf|\.sys|\.theme|\.tmp|\.ttf|\.url|\.vb|\.vba|\.vbe|\.vbp|\.vbs|\.vhd|\.vhdx|\.vsmacros|\.vsw|\.vxd|\.webpnp|\.website|\.wim|\.ws|\.wsc|\.wsf|\.wsh|\.xbap|\.xll|\.xnk)$\N}{1}{0}}

  accept

That looks good.

Show the output of these commands:

exim4 --version | head -n 1
dpkg -l | grep -E '^ii.*exim'
root@server2:~# exim4 --version | head -n 1
dpkg -l | grep -E '^ii.*exim'
2024-06-16 05:58:48 Exim configuration error in line 41 of /var/lib/exim4/config.autogenerated:
  main option "acl_smtp_mime" unknown
Exim version 4.95 #2 built 11-Jan-2024 13:16:58
ii  exim4                                  4.95-4ubuntu2.5                              all          metapackage to ease Exim MTA (v4) installation
ii  exim4-base                             4.95-4ubuntu2.5                              amd64        support files for all Exim MTA (v4) packages
ii  exim4-config                           4.95-4ubuntu2.5                              all          configuration for the Exim MTA (v4)
ii  exim4-daemon-light                     4.95-4ubuntu2.5                              amd64        lightweight Exim MTA (v4) daemon

That is the problem, that is not the right package you should have installed. What happened to your server? Did you reinstall exim?

Anyway, to fix it.

Backup your current conf.

mkdir /root/backup_etc_exim4_2024-06-16/
cp -rf /etc/exim4/ /root/backup_etc_exim4_2024-06-16/

Uninstall exim4-daemon-light and install exim4-daemon-heavy

apt remove exim4-daemon-light
apt install exim4-daemon-heavy

Thank you.
The exim service is now running, and yes I did reinstall exim4 due to an error I was having with roundcube on all accounts. Accounts could not send emails, they were getting this error: External SMTP 535 Error Authentication Failed

Now after fixing this exim4 issue, this is the error they get: SMTP Error (451): Failed to add recipient "[email protected]" (Temporary local problem - please try later).

You should have to replace the saved conf.

cp /root/backup_etc_exim4_2024-06-16/exim4/exim4.conf.template /etc/exim4/

And show me this:

ls -l /etc/exim4/
grep -Ei '^[a-z]' /etc/exim4/update-exim4.conf.conf
root@server2:~# cp /root/backup_etc_exim4_2024-06-16/exim4/exim4.conf.template /etc/exim4/
root@server2:~# ls -l /etc/exim4/
grep -Ei '^[a-z]' /etc/exim4/update-exim4.conf.conf
total 52
drwxr-xr-x 9 root root         4096 Jun 15 20:51 conf.d
-rw-r--r-- 1 root root           32 May 14 22:39 dnsbl.conf
drwxr-xr-x 2 root root         4096 Jun 16 01:14 domains
-rw-r--r-- 1 root root        17122 Jun 16 06:56 exim4.conf.template
-rw-r--r-- 1 root root            3 May 14 22:39 limit.conf
-rw-r----- 1 root Debian-exim   204 Jan 11 13:16 passwd.client
-rw-r--r-- 1 root root            0 May 14 22:39 spam-blocks.conf
-rw-r----- 1 root Debian-exim    17 May 14 22:39 srs.conf
-rw-r--r-- 1 root root          442 May 14 22:39 system.filter
-rw-r--r-- 1 root root         1052 Jun 16 02:23 update-exim4.conf.conf
-rw-r--r-- 1 root root            0 May 14 22:39 white-blocks.conf
dc_eximconfig_configtype='local'
dc_other_hostnames='server2.premium-webservers.com'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
root@server2:~#

Are you sure you backed up correctly the exim4 dir?
I’m asking because the older exim4.conf.template and the one you have copied doesn’t have the same size…

Yes I did the backup

And why it has a different size?

That i can not say because I’m quite confused as to why the mail stopped working before I decided to reinstall the exim4 (which I ended up with the wrong one that you just corrected).

Apart from that, there’s nothing else I did.

Ok, but it works now?

No it did not work as accounts still can’t send emails via roundcube

SMTP Error (451): Failed to add recipient "[email protected]" (Temporary local problem - please try later).

Show the exim log (replace [email protected] by the real data:

exigrep '[email protected]' /var/log/exim4/mainlog

Also, are you using clamav, spamassassin, dovecot and/or sieve?

Upload to some site, like pastebin or similar the entire conf file /etc/exim4/exim4.conf.template

You can do it easily with this command:

cat /etc/exim4/exim4.conf.template | nc termbin.com 9999

Hi Sahsanu,

  1. This is the pastebin link for exigrep '[email protected]' /var/log/exim4/mainlog: https://pastebin.com/jwMB8s9g

  2. Yes I have clamav, spamassasin and dovecot

  3. /etc/exim4/exim4.conf.template is uploaded here: https://termbin.com/jra1

Replace your exim config with this one https://termbin.com/43n1

mkdir /root/backup_exim4_2024-06-16_v2/
cp -rf /etc/exim4/ /root/backup_exim4_2024-06-16_v2/
wget https://termbin.com/43n1
mv 43n1 /etc/exim4/exim4.conf.template
systemctl restart exim4
1 Like

Thank you so so much! :pray:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.