Solution for fatal error in dovecot configuration file

Published Wed Jun 14 2017

While setting up a mail server, I ran into a curious issue which I have documented below for posterity. After modifying the dovecot configuration and attempting to start the dovecot service I received the following error:

doveconf: Fatal: Error in configuration file /etc/dovecot/conf.d/10-mail.conf line 31: Unknown setting: mail_location

The error is not actually in the file 10-mail.conf at at all. As it turns out I caused this problem when I edited the file /etc/dovecot/conf.d/auth-system.conf.ext and did not put a closing brace on the last line. More accurately, I did not uncomment the closing brace for the section I edited. My broken config change looked like this:

# Static settings generated from template <doc/wiki/UserDatabase.Static.txt>
userdb {
  driver = static
  # Can return anything a userdb could normally return. For example:
  #
  args = uid=mail gid=mail home=/var/mail/%d/%n
#}

Since the closing curly brace isn’t uncommented, and my configuration is broken up over several files, dovecot tries to set mail_location in the userdb section. That’s not a valid userdb option and so it fails. If you run into this class of error you may see a different file referenced and a different setting, but the general solution should still apply. Close your braces properly.

The correct version—with # removed from before the closing curly brace—is below.

# Static settings generated from template <doc/wiki/UserDatabase.Static.txt>
userdb {
  driver = static
  # Can return anything a userdb could normally return. For example:
  #
  args = uid=mail gid=mail home=/var/mail/%d/%n
}