Page MenuHomeDevCentral

Grafana doesn't have permissions to run database migrations
Closed, ResolvedPublic

Description

Grafana server doesn't currently run on WindRiver.

Debugging why running the server command as grafana user:

WindRiver
$ /usr/local/bin/grafana server -config=/usr/local/etc/grafana/grafana.ini -homepath=/usr/local/share/grafana
INFO [12-24|12:53:15] Connecting to DB                         logger=sqlstore dbtype=sqlite3
INFO [12-24|12:53:15] Starting DB migrations                   logger=migrator
Error: ✗ failed to check table existence: unable to open database file: permission denied

Event Timeline

dereckson triaged this task as High priority.Tue, Dec 24, 12:54
dereckson created this task.
dereckson updated the task description. (Show Details)

I don't know why a lot of files was mine.

$ cd /var/db/grafana
$ ls -lah

total 856
drwxr-x---   7 grafana   grafana      8B Dec 24 12:51 .
drwxr-xr-x  24 root      wheel       30B Oct 13 10:53 ..
drwxr-x---   3 dereckson dereckson    3B Jul 25 19:00 alerting
drwx------   2 dereckson dereckson    2B Jul 25 19:00 csv
-rw-r-----   1 dereckson dereckson  3.4M Dec 24 12:51 grafana.db
drwx------   2 dereckson dereckson    2B Jul 25 19:00 pdf
drwxr-x---   2 grafana   grafana      2B Sep 22 08:26 plugins
drwx------   2 dereckson dereckson    2B Jul 25 19:00 png

As it's not intended by the role, I guess it can be fixed with:

$ chown -R grafana:grafana /var/db/grafana

But that directory isn't currently created or managed by the role, we should add that there too.

data

Path to where Grafana stores the sqlite3 database (if used), file-based sessions (if used), and other data. This path is usually specified via command line in the init.d script or the systemd service file.

Incident fixed, Grafana is running.

Furthermore, we've a Salt configuration for the directory and the permissions.