Ask Your Question

ybathia's profile - activity

2015-02-18 14:00:46 -0500 received badge  Enthusiast
2015-02-05 09:46:14 -0500 received badge  Famous Question (source)
2015-01-23 19:06:38 -0500 received badge  Student (source)
2015-01-23 18:54:59 -0500 received badge  Notable Question (source)
2015-01-23 18:54:59 -0500 received badge  Popular Question (source)
2015-01-21 20:02:54 -0500 asked a question openstack_dashboard wsgi gives "m2crypto.so: wrong ELF class: ELFCLASS32" error

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 ?