openstack_dashboard wsgi gives "m2crypto.so: wrong ELF class: ELFCLASS32" error

asked 2015-01-21 19:52:19 -0600

ybathia gravatar image

updated 2015-01-22 01:20:35 -0600

We use m2crypto library with keystone for authentication.While running Horizon on rhel6 64 bit ,I encountered this error:

[Thu Jan 22 00:41:41 2015] [notice] Apache/2.2.26 (Unix) mod_wsgi/3.4 Python/2.6.6 configured -- resuming normal operations
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160] mod_wsgi (pid=6857): Exception occurred processing WSGI script '/home/y/lib/python2.6/site-packages/openstack_dashboard/wsgi/django.wsgi'.
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160] Traceback (most recent call last):
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160]   File "/home/y/lib64/python2.6/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160]     self.load_middleware()
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160]   File "/home/y/lib64/python2.6/site-packages/django/core/handlers/base.py", line 47, in load_middleware
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Wed Jan 21 18:42:38 2015] [error] [client 10.73.205.160] ImproperlyConfigured: Error importing middleware openstack_auth.middleware: "/home/y/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../M2Crypto/__m2crypto.so: wrong ELF class: ELFCLASS32"

By searching the internet, I found that this error is thrown when we build a 32 bit python module on a 64 bits system. So, M2Crypto needs python 64 bit to run on rhel6 64 bit and as a result /lib64/python should be ahead of /lib/python in the sys path. I found that in the following commit we introduce a fix for the sys.path https://github.com/openstack/horizon/commit/c01ebad629a7d78c769b2c5c0072e59d24940746 (https://github.com/openstack/horizon/...) .

The above fix inserts /lib/python at the 0th position , which caused the error.By changing sys.path.insert to sys.path.append in the above commit, I was able to solve my problem. Is this a bug? Shall we fix it to sys.path.append ?

edit retag flag offensive close merge delete