Horizon Apache launch error

Asked by Yitao Jiang on 2013-06-13

   I installed the horizon (stable/grizzly) in frdora 18 , after installation all works fine. But when i lanch the browser , the pages print that

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.

and i run command tailf /var/log/httpd/horizon_error.log said

[Thu Jun 13 16:48:37.022157 2013] [:error] [pid 42531] [remote] mod_wsgi (pid=42531): Exception occurred processing WSGI script '/opt/stack/horizon/openstack_dashboard/wsgi/django.wsgi'.
[Thu Jun 13 16:48:37.022285 2013] [:error] [pid 42531] [remote] Traceback (most recent call last):
[Thu Jun 13 16:48:37.022334 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Thu Jun 13 16:48:37.022418 2013] [:error] [pid 42531] [remote] self.load_middleware()
[Thu Jun 13 16:48:37.022444 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 39, in load_middleware
[Thu Jun 13 16:48:37.022482 2013] [:error] [pid 42531] [remote] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Thu Jun 13 16:48:37.022505 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
[Thu Jun 13 16:48:37.022541 2013] [:error] [pid 42531] [remote] self._setup()
[Thu Jun 13 16:48:37.022563 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
[Thu Jun 13 16:48:37.022597 2013] [:error] [pid 42531] [remote] self._wrapped = Settings(settings_module)
[Thu Jun 13 16:48:37.022618 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
[Thu Jun 13 16:48:37.022649 2013] [:error] [pid 42531] [remote] mod = importlib.import_module(self.SETTINGS_MODULE)
[Thu Jun 13 16:48:37.022671 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
[Thu Jun 13 16:48:37.022704 2013] [:error] [pid 42531] [remote] __import__(name)
[Thu Jun 13 16:48:37.022725 2013] [:error] [pid 42531] [remote] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/settings.py", line 182, in <module>
[Thu Jun 13 16:48:37.022762 2013] [:error] [pid 42531] [remote] from local.local_settings import *
[Thu Jun 13 16:48:37.022783 2013] [:error] [pid 42531] [remote] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/local/local_settings.py", line 92, in <module>
[Thu Jun 13 16:48:37.022818 2013] [:error] [pid 42531] [remote] SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))
[Thu Jun 13 16:48:37.022892 2013] [:error] [pid 42531] [remote] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/utils/secret_key.py", line 55, in generate_or_read_from_file
[Thu Jun 13 16:48:37.022945 2013] [:error] [pid 42531] [remote] with lock:
[Thu Jun 13 16:48:37.022969 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/lockfile/__init__.py", line 226, in __enter__
[Thu Jun 13 16:48:37.023004 2013] [:error] [pid 42531] [remote] self.acquire()
[Thu Jun 13 16:48:37.023025 2013] [:error] [pid 42531] [remote] File "/usr/lib/python2.7/site-packages/lockfile/linklockfile.py", line 20, in acquire
[Thu Jun 13 16:48:37.023079 2013] [:error] [pid 42531] [remote] raise LockFailed("failed to create %s" % self.unique_name)
[Thu Jun 13 16:48:37.023129 2013] [:error] [pid 42531] [remote] LockFailed: failed to create /opt/stack/horizon/openstack_dashboard/local/stackdev-96020700.42531

Below is my configuation of httpd

cat /etc/httpd/conf.d/horizon.conf

<VirtualHost *:80>
    WSGIScriptAlias / /opt/stack/horizon/openstack_dashboard/wsgi/django.wsgi
    WSGIDaemonProcess horizon user=stack group=stack processes=3 threads=10 home=/opt/stack/horizon
    WSGIApplicationGroup %{GLOBAL}

    SetEnv APACHE_RUN_USER stack
    SetEnv APACHE_RUN_GROUP stack
    WSGIProcessGroup horizon

    Documentroot /opt/stack/horizon/.blackhole/
    Alias /media /opt/stack/horizon/openstack_dashboard/static

    <Directory />
        Options FollowSymLinks
        AllowOverride None

    <Directory /opt/stack/horizon/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
        Order allow,deny
        allow from all

    ErrorLog /var/log/httpd/horizon_error.log
    LogLevel warn
    CustomLog /var/log/httpd/horizon_access.log combined

WSGISocketPrefix /var/run/httpd

Is there is anything wrong with my configuation ?

Question information

English Edit question
OpenStack Dashboard (Horizon) Edit question
No assignee Edit question
Solved by:
Yitao Jiang
Last query:
Last reply:

This question was reopened

Julie Pichon (jpichon) said : #1

I think LockFailed is related to a SELinux issue. You can try doing "setenforce 0" and see if that solves it. Unfortunately, I don't know which SELinux boolean in particular needs to be turned on if you want to keep SELinux enabled (please post an update if you figure it out!).

Yitao Jiang (jiangytcn) said : #3

I tried using setenforce 0 but i still does't work. It really confused me . I chang the ownership of /opt/stack/horizon/openstack_dashboard/local/ to nobody:nobody , it does't make sense at all.

Yitao Jiang (jiangytcn) said : #4

Hi, i just solve it by rewriting some code of local_settings.py file. The previous LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) , and then i change it to LOCAL_PATH = '/tmp' .
Besides i change the ownership of folders of horizon to stack:stack . Now all works fine.

Julie Pichon (jpichon) said : #5

Excellent, thanks for the update. Glad you solved it!

chchen (cc272309126) said : #6

Hi, it can fix this bug on the fedora 18.if you change it to LOCAL_PATH = '/tmp',it will report the error "unable to apply CompilerFilter" . I fix it by add ” os.system('setenforce 0') “ in local_settings.py. pls update it.

Matthias Runge (mrunge) said : #7

Is apache able to write to /opt/stack/horizon/openstack_dashboard?

You can verify, this isn't related to selinux be setting temporarily selinux to permissive:
setenforce permissive

Matthias Runge (mrunge) said : #8

You probably want to change 'LOCAL_PATH' from your openstack_dashboard/local/local_settings.py.example (resp. local_setting.py) to something like '/tmp'.