Cannot install plugins when I install grafana and plugins through a a script. But it works fine when installed manually

I am using grafana_4.6.0. and i am using gnocchixyz-gnocchi-datasource datasource and running on ubuntu. I am trying to insatll grafana plugins through a script where after insatlling the grafana I install plugins using query ‘grafana-cli plugins install gnocchixyz-gnocchi-datasource’. The problem is when I install it through script, and execute cli ‘grafana-cli plgins ls’ to list installed plugins it shows gnocchi plugin as installed. But that plugin is not shown in grafana dashboard and I cannot add datasource of that plugin. But when I install plugins manually without using script, It works fine. Can anyone please help me with this. On restarting grafana server, it gives “Could not scan dir “/var/lib/grafana/plugins” error: open /var/lib/grafana/plugins: permission denied” in grafana logs. If it is a permission issue. How to solve it?

Check permissions for /var/lib/grafana/plugins before and after you run your script. It may be caused by executing script from the user with different access rights for this directory (user which used for grafana-server service can’t access this dir changed by the user which script was run under).

Yes. This was a permission issue. Changed the permissions and it is working fine now. Thank you.

Hi, I’m also facing same issue

Could you please let me know Where did you change the permission and what permission you have given