1

While making some changes in exim4, I decided to use the monolithic config style. So as not to confuse myself, I deleted /etc/exim4/conf.d/. I now regret this and wish to switch back to the split config style.

However, no amount of dpkg-recongifureing or update-exim4.confing will bring the files back. In fact, I am thoroughly confused by the configuration scheme for exim4 on ubuntu 16.04.

Could someone tell me how to restore the split configuration files and remove exim4.conf.template? (I don't mind if this reset my configuration, I can easily restore it).

Could someone please explain how exim decides which config files to load in which order? The manuals reference all sorts of default filenames.

James Swift
  • 144
  • 1
  • 14
  • Initial config file location/name is compiled in at the package build stage, but you can override it by `-C config.file`. That file should contain `.include ` or `.include_if_exists ` directives that are traversed recursively at startup. – Kondybas Sep 20 '16 at 17:13

2 Answers2

3

The split configuration template is located in exim4-config (You can confirm this with dpkg -S /etc/exim4/conf.d/auth You will need to reinstall that package using

apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall exim4-config

to reinstall the package and restore the missing configuration files. Once the configuration files are restored then you can use

dpkg-reconfigure exim4-config

to switch between the monolithic configuration and split configuration. Any changes made to the monolithic configuration will need to be redone in the split configuration.

The split configuration uses separate folders to represent the sections of the configuration file. Within each folder, update-exim4.conf will concatenate all of the files in alphanumeric order. If creating new files, it's important to ensure that they sort after the 00_exim4-config_header section, since this file contains the begin line for that section.

DerfK
  • 19,313
  • 2
  • 35
  • 51
  • Afterwards, can I delete exim4.conf.template? – James Swift Sep 20 '16 at 17:30
  • I don't think it would harm anything either way. You could rename it to something else first to see if anything breaks – DerfK Sep 20 '16 at 18:51
  • What I'm still confused about, is how exim knows which file to read. The monolithic block, or the conf.d files. Where is the pointer? For example, apache has a main apache.conf with a line that explicitly includes any other conf files/directories. I'm not sure how exim decides. – James Swift Sep 20 '16 at 20:17
  • exim reads neither. When you execute the `update-exim4.conf` program, it checks `dc_use_split_config` to pick whichever files, then merges them with the rest of the configuration values in `update-exim4.conf.conf` to create `/var/lib/exim4/config.autogenerated`, and the default exim startup scripts use that file. – DerfK Sep 20 '16 at 20:22
  • @JamesSwift if it doesn't automatically reconfigure when you reinstall `exim4-config` do `dpkg-reconfigure exim4-config` to get the question of whether you want the split configuration or not again. – DerfK Sep 20 '16 at 20:24
  • Ah ha. Do I take it that exim (possibly systemd) executes update-exim4.conf on start? I found that variables were auto applied with a service restart, without `update-exim4.conf` – James Swift Sep 20 '16 at 20:26
  • Probably. The whole thing is a Debianism not part of exim, so it would be the startup script/unit file that handles it. – DerfK Sep 20 '16 at 20:28
  • Ok, tried the reinstall. It created the conf.d directory structure, but no files. – James Swift Sep 20 '16 at 20:42
  • http://askubuntu.com/a/67028 – DerfK Sep 20 '16 at 21:06
  • Cheers. That's got it sorted. Thanks so much. I've summed that up in a new answer below. You can either vote it up, or edit your original and I'll mark it correct. – James Swift Sep 20 '16 at 21:53
3

To answer my own question, based on @DerfK's answer. To regenerate the exim config files, the best way is to do the following:

sudo mv /etc/exim4 /etc/exim4-old
sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall exim4-config
sudo dpkg-reconfigure exim4-config

Warning, this will reset exim's configuration to default. Your old config is available in /etc/exim4-old/.

James Swift
  • 144
  • 1
  • 14