Dovecot "Cannot allocate memory" error
Posted March 12th, 2008 in Email Servers
Installing the Dovecot IMAP/POP server onto a CentOS 5.1 x86_64 machine I was unable to log in via POP or IMAP and got the error message "imap-login: imap-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory" in the mail log file when Dovecot started up. This post looks at the error messages reported and the solution. This issue will be the same on a Red Hat Enterprise Linux x86_64 installation as well; whether it affects the 32 bit version I do not know.
Installing Dovecot
I installed dovecot in the usual way:
yum install dovecot
and then started the dovecot service:
/etc/init.d/dovestart start
and enabled it to start automatically on boot:
chkconfig dovecot on
No response when logging in via POP
To test everything was working OK, I attempted to log into the POP server from the command line like so:
telnet localhost 110
I received the usual initialisation information:
Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'.
but then nothing happened. I knew something was up so checked the log files.
Checking the log files, error messages
I ran "tail -f /var/log/maillog" against the log files and watched what happened when I restarted dovecot, and discovered the following error messages:
MarĀ 6 09:19:33 www dovecot: Dovecot v1.0.rc15 starting up Mar 6 09:19:34 www dovecot: Temporary failure in creating login processes, slowing down for now Mar 6 09:19:34 www dovecot: imap-login: imap-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory Mar 6 09:19:34 www dovecot: pop3-login: pop3-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory Mar 6 09:19:34 www dovecot: child 2148 (login) returned error 127
Set the login_process_size variable
After a quick search on Google, I discovered that on 64 bit machines the login_process_size variable must be set to 64 in order for dovecot to work. The default setting is 32, which seems to work fine for 32 bit machines because I have a 32 bit installation of CentOS running dovecot and the default 32MB setting seems to be fine.
To change the setting, edit /etc/dovecot.conf and find the following section:
# Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. #login_process_size = 32
Uncomment the #login_process_size and change it to 64 like so:
login_process_size = 64
Then it's simply a matter of restarting dovecot and everything should work fine:
/etc/init.d/dovecot restart
Problem Solved
After restarting dovecot with the above command, the output from the maillog looked like this:
MarĀ 6 09:20:33 www dovecot: Killed with signal 15 Mar 6 09:20:33 www dovecot: Dovecot v1.0.rc15 starting up
and there were no error messages. Connecting to the pop server from the command line now looks like this:
Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. +OK Dovecot ready.
So that looks good as well. I was then succesfully able to log in as a valid user and download mail.
Subscribe!
If you found this post interesting and would like to be notified the next time something is posted, please subscribe to my RSS Feed. Thanks for visiting!

