Solution to 'malformed macro definition' and 'DEBCONFsomethingDEBCONF found in exim configuration'
Upgrading a working server application is always tricky. This is especially true if the upgrade had changes in configuration files and you had customizations done in your local configuration file. The recent exim4 upgrade to version 4.67-3 had structural changes in the configuration files. The suggested upgrade method is to accept all the modifications provided by the upgrade and redo the customizations. But what if you did not read the instructions properly and ended having an exim4 installation that throws out errors every time you try to start exim4.
The common error that you could get is
DEBCONFsomethingDEBCONF found in exim configuration
If somehow you get around the above error you might come across the following one
/var/lib/exim4/config.autogenerated.tmp: malformed macro definition
If you read the documentation correctly you will see that the first one is because the update-exim4.conf script checks for lines with DEBCONF inside the configuration file. If the configuration file template or the split templates were processed correctly then these should have been replaced during the generation of the configuration file in /var/lib/exim4. The cause of the problem is that during the upgrade you did not allow the application to accept the modifications in the new version and left the old configurations files as they where.
The simplest solution to the problem is to take the exim4 deb packages, extract them and take out the pristine configuration files from inside them and replace the /etc/exim4/conf.d folder (if you use the split template option) or replace the exim4.conf.template(if you use the single file configuration file option). Make sure you back up the old files before you replace the originals. Now you do a compare with the old files and identify all the customizations that you had made inside them and port these customizations to the new configuration file. Once you are done you should be able to restart exim4 without any configuration file errors.
Once the server is up and running, monitor all the functionalities to make sure that everything is running as it is supposed to before you relax. You should be careful with custom access control rules or custom header overwrite rules that decide your normal operations. Also let your users know that you have made an upgrade and that they might face problems as a preemptive bail :-)