#992012 dovecot bind error

Package:
dovecot-core
Source:
dovecot
Description:
secure POP3/IMAP server - core files
Submitter:
John
Date:
2021-08-08 19:00:03 UTC
Severity:
normal
#992012#5
Date:
2021-08-08 18:57:16 UTC
From:
To:
Dovecot fails to start if cloud packages are removed. The service has "After=local-fs.target network-online.target". Probably the network-online.target is gone, the service started too early, before ip addresses are assigned.

Errors:
dovecot[320]: Error: bind(n.n.n.n, 993) failed: Cannot assign requested address
dovecot[320]: Error: service(imap-login): listen(n.n.n.n, 993) failed: Cannot assign requested address
dovecot[320]: Error: bind(n:n:n:n:n:n:n:n, 993) failed: Cannot assign requested address
dovecot[320]: Error: service(imap-login): listen(n:n:n:n:n:n:n:n, 993) failed: Cannot assign requested address
dovecot[320]: Fatal: Failed to start listeners

dovecot.service is defined here:
/etc/systemd/system/multi-user.target.wants/dovecot.service
Below [unit]:
After=local-fs.target network-online.target

This can be fixed by using:
After=local-fs.target network.target

Or by appending " network.target":
After=local-fs.target network-online.target network.target

This may work with or without cloud (not tested with cloud). It fixes the problem when cloud functions have been removed.

Activate change:
systemctl daemon-reload