Grafana can't open sqlite datasource citing permissions but will work when db is opened in a separate command line session

  • What Grafana version and what operating system are you using?
  • What are you trying to achieve?
    Be able to use sqlite3 database as datasource for dashboard
  • How are you trying to achieve it?
  1. Downloaded the sqlite plugin
  2. Defined the datasource
  3. Created the dashboard
  • What happened?
    When initially defining the datasource, I would get this error:
    error checking db: error checking for valid SQLite file: unable to open database file (14)
    However when i try to open the database in a command line session and until a run a command such as .tables
    Data source now shows as :
    Data source is working
    and the dashboard begins showing data.
  • What did you expect to happen?
    I expected that I don’t have to do any separate session to fire up the sqlite3 database and run a command for my Grafana dashboard to work
  • Can you copy/paste the configuration(s) that you are having problems with?
    I tried this grafana server configuration but to no avail:
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    for Grafana UI: see above
    for logs (just one of many similar logs):
    logger=plugin.frser-sqlite-datasource t=2024-02-19T16:46:20.274338561Z level=error msg=“Could not execute query” err=“unable to open database file (14)” query=“select upper(distinct(team)) from test_series where team like "XX%" or team like "XX%";\n\n”
  • Did you follow any online instructions? If so, what is the URL?
    Recommended installation from:
    grafana-sqlite-datasource/docs/ at main · fr-ser/grafana-sqlite-datasource · GitHub

welcome to forum @empunzalan

what operating system is this in?
what is the location of the sqlite file?

1 Like

thanks for the welcome @yosiasz !

i’m running this on an ubuntu 18.04.4 LTS and the db file is in the defined grafana homedir /usr/share/grafana

sounds like grafana or the usr running grafana does not have permission to that folder?

the home directory for grafana:

drwxrwxr-t 6 grafana grafana 73728 Feb 19 16:11 /usr/share/grafana

the ownership is by a user named robot and has the following permissions:

-rwxrwxrwx 1 robot robot 29167616 Feb 19 15:28 test.db

these are the two users and their groups:

id robot
uid=1013(robot) gid=1001(robot) groups=1001(robot),115(grafana)

id grafana
uid=111(grafana) gid=115(grafana) groups=115(grafana),1001(robot)

notice that one is a member of the other user’s group.

as user grafana, i can open the db file owned by robot.

it seems that grafana has issues with data sources that are located in /usr/share. i’ve tried moving it to /var/lib and i don’t get any problems.

1 Like