[Dovecot] master: Error: service(config): Initial status notification not received in 30 seconds, killing the process

If you’re running a very large dovecot config that takes a long time to load and dovecot won’t start you’re going to see this error:

master: Error: service(config): Initial status notification not received in 30 seconds, killing the process

In our case we have many certificates to load from the SNI configs.

You’ll also see some accompanying errors from different services while the config is loading:

dovecot[22118]: lmtp: Fatal: Error reading configuration: read(/var/run/dovecot/config) failed: read(size=8192) failed: Interrupted system call

This is one of the more tricky problems to track down a solution to. The problem is that hardcoded into the source of dovecot is a 30 second time limit for loading the config. If it doesn’t complete in 30 seconds it kills the process and tries again. The problem is that if there’s nothing you can do to reduce the size of your configuration substantially and you can’t do anything to speed up its loading then the limit needs to be changed. Since it’s in the source code we can’t just change the config or any system settings. We need to change it in the source code and recompile.

In the source there is src/master/service.h.

Change this line:

#define SERVICE_FIRST_STATUS_TIMEOUT_SECS 30

to this:

#define SERVICE_FIRST_STATUS_TIMEOUT_SECS 60

Obviously, you can raise it above 60 seconds but that’s probably unnecessary. Once that’s done recompile and reinstall. It’s likely going to mean building a new rpm from a source rpm.

Note: In directadmin you build source for dovecot like this:

cd /usr/local/directadmin/custombuild

./build clean

./build dovecot

This will automatically download a new dovecot-version.tar.gz file. To modify the source you need to follow this process:

1. Copy the source tarball somewhere else.

2. Unpackage it.

3. Change the source code with the change I described above.

4. Create a new tarball with the altered source:

tar -cvzf dovecot-version.tar.gz dovecot-version/

5. Overwrite the original tarball with the new one.

6. *Super Important* You need to make the new tarball immutable so that it will not be overwritten when DirectAdmin decides to download the source:

chattr +i dovecot-version.tar.gz

7. Backup your /etc/dovecot directory and your /etc/dovecot.conf file.

8. Now you can go ahead and build your new dovecot:

cd /usr/local/directadmin/custombuild

./build clean

./build dovecot

Note: Building this in DirectAdmin also installs it automatically. It’s not a separate step.