I had to change the root password for MySQL on a server. Exim also uses MySQL for users etc.

I didn't think Exim/Dovecot used that password, but now things are not working well and I'm pretty sure they are related.

When I try to start Exim:

Starting exim: Error loading mysql.so: /usr/lib64/exim/4.72-6.6.amzn1/lookups/mysql.so: undefined symbol: mysql_servers
2014-09-13 19:13:22 Error loading lookup module mysql.so: NULL

Running service --status-all gives me

exim dead but subsys locked

I've checked for /eximdisable in /etc/, nothing there.

Disk space is 85% used, file handles 7% used.


I have seen this recently. I built some Exim 4.84 rpms for a friend on Amazon EC2 servers based on CentOS 6 (you don't say which version of Amazon's servers you are running). I had to reconfigure the spec file to compile and link the mysql module directly into the Exim binary, instead of making it a loadable module. I do not know why this global variable is not visible to the mysql loadable module on Amazon servers because it is visible on every other architecture I've ever built Exim on.

My first hunch is it has something to do with the gcc version and how it handles optimization flags. But that is not supported by any evidence or facts, it's just a hunch.

  • It's the Amazon AMI Linux. 2014.03. – dubRun Sep 15 '14 at 19:45
  • I have opened a bug in the Exim bug tracker. Hopefully some collaboration will help find the root cause. – Todd Lyons Sep 17 '14 at 18:22

It turns out that it has nothing to do with the gcc version or optimization failures. Instead, it's an incomplete compile/link of the exim binary. There is a flag (-rdynamic) for gcc to tell the linker to export the symbols to be visible to dynamically loaded modules. This flag must be passed to gcc when building the mysql.so and when building the Exim binary.

If this RPM is based on a Fedora exim.spec file (mine was), I've found that there are patches that set the LFLAGS variable in Local/Makefile, but then the make command overrides LFLAGS on the commandline. Simply move whatever you are setting LFLAGS to into your Local/Makefile and remove it from the make command:

# This used to be set on the make commandline
echo 'LFLAGS+=-pie' >> Local/Makefile
# Then further down where the make command is,
# remove the LFLAGS= setting, leaving only:
make _lib=%{_lib} FULLECHO=

Othersie, it's likely that all you need is to add to the end of your Local/Makefile:

LFLAGS+=-rdynamic -ldl
# _OR_
EXTRALIBS_EXIM+=-rdynamic -ldl

More detail is available here: https://stackoverflow.com/a/482556/611911

Note: While you accepted the first answer I provided, all it really does is say "yeah, I had the problem too." This answer actually fixes the problem. :-)


Exim can't load mysql.so because it hasn't built. You have to ensure you have at least mysql-client installed properly.

  • Not sure what you are referring to. Can you elaborate a bit? I've reinstalled exim-mysql and no luck with that. – dubRun Sep 14 '14 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.