Problem
Users in a larger Dovecot-based IMAP-Environment are unable to logon.
Investigation
In /var/log/dovecot.err messages like the following appear:
Apr 11 11:11:11 imapserver001 dovecot: imap-login: Error: net_accept() failed: Too many open files
Apr 11 11:11:11 imapserver001 dovecot: imap-login: Error: socketpair() failed: Too many open files
Explanation
The default limits are too low for this usecase.
root@imapserver001:~# systemctl show dovecot.service | grep -i limitno
LimitNOFILE=4096
LimitNOFILESoft=1024
Solution
Adjust the limit by adding an override configuration to an appropriate value or to “infinity” (unlimited).
use:
systemctl edit dovecot.service
and add the following lines
[Service]
LimitNOFILE=infinity
Note: this creates or edits the file /etc/systemd/system/dovecot.service.d/override.conf
root@imapserver001:~# systemctl show dovecot.service | grep -i limitno
LimitNOFILE=18446744073709551615
LimitNOFILESoft=18446744073709551615
You will have to run service dovecot restart
after changing these values