Slow performance with dovecot – mysql – roundcube

This drove me crazy forever, and Google wasn’t too helpful.  If you’re running dovecot with mysql authentication, your logins will be exceedingly slow.  This isn’t much of a problem with traditional mail clients – just an annoying bit of a hiccup you probably won’t even notice except for SASL authentication when sending mail – but it makes Roundcube webmail PAINFULLY painfully slow in a VERY obvious way.

The issue is due to PAM authentication being enabled by default in Dovecot, and on Ubuntu at least, it’s done in a really hidden little out-of-the-way file with no easy way to forcibly override it elsewhere that I’m aware of.

Again on Ubuntu, you’ll find the file in question at /etc/dovecot/conf.d/auth-system.conf.ext, and the relevant block should be commented out COMPLETELY, like this:

# PAM authentication. Preferred nowadays by most systems.
# PAM is typically used with either userdb passwd or userdb static.
# REMEMBER: You'll need /etc/pam.d/dovecot file created for PAM
# authentication to actually work. <doc/wiki/PasswordDatabase.PAM.txt>
#passdb {
  # driver = pam
  # [session=yes] [setcred=yes] [failure_show_msg=yes] [max_requests=]
  # [cache_key=] []
  #args = dovecot

Once you’ve done this (and remember, we’re assuming you’re using SQL auth here, and NOT actually USING the PAM!) you’ll auth immediately instead of having to fail PAM and then fall back to SQL auth on every auth request, and things will speed up IMMENSELY. This turns Roundcube from “painfully slow” to “blazing fast”.

Published by

Jim Salter

Mercenary sysadmin, open source advocate, and frotzer of the jim-jam.

13 thoughts on “Slow performance with dovecot – mysql – roundcube”

  1. Alternatively, you can just comment out the line !include auth-system.conf.ext in the file 10-auth.conf. Same effect, but a bit cleaner. Debian 7 here, exim+dovecot(sqlite)+roundcube

  2. Very useful. This just stopped me going round and round in circles!

    Thank you so much!

  3. Oh. My Word.

    The difference is literally black and white!

    Thank you SO much.

    I have added it to my wiki as well.

  4. Just had to say, this was so hard to find but this was the solution! I can’t believe this isn’t mentioned in any tutorial.

  5. Great googly moogly… This is great… I’ve been troubleshooting slow issues with my dovecot server on ubuntu 18.04 forever (at least two months off and on) and never found the right google search terms to stumble across this article until today!…

  6. Hello from 2020. You saved my day!!! Fresh installation of Roundcude with one email in mailbox was taking seconds to show inbox screen. My brain was boiling…. Thanks!!!!

  7. Muchísimas gracias, fue de gran ayuda tu publicación, me ayudó a resolver la lentitud en dovecot.

Leave a Reply

Your email address will not be published. Required fields are marked *