fr-ser / grafana-sqlite-datasource

Grafana Plugin to enable SQLite as a Datasource
Apache License 2.0
124 stars 17 forks source link

Error `Plugin unavailable` when trying to save and test data source #86

Closed yuuyins closed 2 years ago

yuuyins commented 2 years ago

Describe the bug

Error Plugin unavailable when trying to save and test data source.

logger=context t=2022-06-02T10:54:46.3+0200 lvl=eror msg="Plugin unavailable" error="plugin unavailable" remote_addr=127.0.0.1

To Reproduce Steps to reproduce the behavior:

  1. sudo grafana-cli plugins install frser-sqlite-datasource
  2. sudo systemctl restart grafana.service
  3. In grafana, configuration>datasources>addsource>sqlite
  4. fill path /path/to/sqlite.db
  5. save & test
  6. See error Plugin unavailable

Screenshots If applicable, add screenshots to help explain your problem.

2022-06-02T14-17-05UTC

Versions (please complete the following information):

Additional context

Add any other context about the problem here. Please also attach the logs of Grafana!

grafana.log

$ sudo ls -la /var/lib/grafana/plugins/frser-sqlite-datasource
[sudo] password for yuu:
total 174140
drwxr-xr-x 1 root root      672 Jun  2 10:53 .
drwxr-xr-x 1 root root       46 Jun  2 10:53 ..
-rw-r--r-- 1 root root     6361 Jun  2 10:53 CHANGELOG.md
-rwxr-xr-x 1 root root 25689680 Jun  2 10:53 gpx_sqlite-datasource_darwin_amd64
-rwxr-xr-x 1 root root 25754770 Jun  2 10:53 gpx_sqlite-datasource_darwin_arm64
-rwxr-xr-x 1 root root 26191653 Jun  2 10:53 gpx_sqlite-datasource_freebsd_amd64
-rwxr-xr-x 1 root root 26045330 Jun  2 10:53 gpx_sqlite-datasource_linux_amd64
-rwxr-xr-x 1 root root 23021775 Jun  2 10:53 gpx_sqlite-datasource_linux_arm
-rwxr-xr-x 1 root root 24872327 Jun  2 10:53 gpx_sqlite-datasource_linux_arm64
-rwxr-xr-x 1 root root 26579968 Jun  2 10:53 gpx_sqlite-datasource_windows_amd64.exe
drwxr-xr-x 1 root root      148 Jun  2 10:53 img
-rw-r--r-- 1 root root    11357 Jun  2 10:53 LICENSE
-rw-r--r-- 1 root root     2445 Jun  2 10:53 MANIFEST.txt
-rw-r--r-- 1 root root    16913 Jun  2 10:53 module.js
-rw-r--r-- 1 root root      808 Jun  2 10:53 module.js.LICENSE.txt
-rw-r--r-- 1 root root    84624 Jun  2 10:53 module.js.map
-rw-r--r-- 1 root root     1183 Jun  2 10:53 plugin.json
-rw-r--r-- 1 root root     8635 Jun  2 10:53 README.md
fr-ser commented 2 years ago

In the logs you attached (thanks for that by the way!) I found this line:

logger=plugin.manager t=2022-06-02T10:53:45.11+0200 lvl=eror msg="Could not start plugin" pluginId=frser-sqlite-datasource err="fork/exec /var/lib/grafana/plugins/frser-sqlite-datasource/gpx_sqlite-datasource_linux_amd64: no such file or directory"

For some reason Grafana does not see the file. Maybe it is a permission thing? I see the root user owns the files. Maybe grafana needs to be the file and folder owner?

I have two ideas you could try:

  1. (remove the current plugin folder and) reinstall the plugin via the grafana-cli but without sudo (so it is not the root user who executes this command and creates the plugin)
  2. Change the owner of the plugin folder to the grafana user (probably grafana but maybe check what users you have): sudo chown -R grafana /var/lib/grafana/plugins
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

yuuyins commented 2 years ago

@fr-ser this is most likely a NixOS specific issue, in which it is trying to find the dynamic loader in a path that does not exist in NixOS; happens when trying to execute a binary in NixOS that was created in another distribution like Ubuntu. As such, I'm closing this issue.