1

Graphite throwing the unable to open database file

tail -f /etc/httpd/logs/error_log 

This is the setting.py file configuration

DATABASES = {
  'default': {
    'NAME': '/opt/graphite/webapp/test.db',
    'ENGINE': 'django.db.backends.sqlite3',
    'USER': '',
    'PASSWORD': '',
    'HOST': '',
    'PORT': ''
  }
}

done

python manage.py  syncdb

The file exists in the below location

[root@bash  graphite]# ls -l /opt/graphite/webapp/test.db
-rw-rw-rw- 1 nobody nobody 65536 Nov 11 22:22 /opt/graphite/webapp/test.db

it throws below error

[Tue Nov 11 22:24:15 2014] [error]   File "/usr/lib/python2.6/site-packages/django/db/backends/util.py", line 53, in execute
[Tue Nov 11 22:24:15 2014] [error]     return self.cursor.execute(sql, params)
[Tue Nov 11 22:24:15 2014] [error]   File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 452, in execute
[Tue Nov 11 22:24:15 2014] [error]     return Database.Cursor.execute(self, query, params)
[Tue Nov 11 22:24:15 2014] [error] OperationalError: unable to open database file

1 Answer 1

6

Check rights of user, from whom you are executing python manage.py syncdb.

This user must have rights to read and write for file /opt/graphite/webapp/test.db

And also to read, write and execute rights for folder /opt/graphite/webapp/

Try this commands (execute from the user, that starts python manage.py syncdb, probably it is current user)

sudo chown `whoami`:`whoami` /opt/graphite/webapp/test.db  # change owner
sudo chmod o+rw /opt/graphite/webapp/test.db  # add rights

sudo chown `whoami`:`whoami` /opt/graphite/webapp/
sudo chmod o+rwx /opt/graphite/webapp/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.