openstack_dashboard wsgi gives " 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] 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] Traceback (most recent call last):
[Wed Jan 21 18:42:38 2015] [error] [client]   File "/home/y/lib64/python2.6/site-packages/django/core/handlers/", line 219, in __call__
[Wed Jan 21 18:42:38 2015] [error] [client]     self.load_middleware()
[Wed Jan 21 18:42:38 2015] [error] [client]   File "/home/y/lib64/python2.6/site-packages/django/core/handlers/", line 47, in load_middleware
[Wed Jan 21 18:42:38 2015] [error] [client]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Wed Jan 21 18:42:38 2015] [error] [client] ImproperlyConfigured: Error importing middleware openstack_auth.middleware: "/home/y/lib/python2.6/site-packages/openstack_dashboard/wsgi/../../M2Crypto/ 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 ( .

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