Mkdir: can't create directory '/var/lib/grafana/plugins': Permission denied

the chown were attempts to fix the errors.

I did not want to find an error and try nothing and just report the bug here.

So, ignore the chown stuff - the basic point is out of the box, the repo does not work because of the permissions errors.

Example

Errors:

grafana_alerts | mkdir: can't create directory '/var/lib/grafana/plugins': Permission denied
grafana_alerts | GF_PATHS_DATA='/var/lib/grafana' is not writable.
grafana_alerts | You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migrate-to-v51-or-later

As noted, I did try several ways to fix but could not solve. Any ideas? Are you able to get it to launch?

This is a 3rd party tool?

basic hello world, docker-compose up and it should work, but is showing a grafana permissions error.

What does it have to do with grafana? From what I can see it has nothing to do with grafana? there is a folder called grafana :smile Have you looked into not using it at all and spinning up your own vanilla grafana and connecting it to questdb and using slack notification?

I have many projects and it is much cleaner to use docker and Terraform etc.
Doing all this via the UI will surely be possible, or ideally the Cloud Grafana, but the basic case of docker-compose up should be a prudent start.

I whole heartedly agree, auto provisioning via docker or podman is the way to go. but again this has nothing to do with grafan other than the mention of a folder called grafana :wink:

The error supplies this as a solution Run Grafana Docker image | Grafana documentation

yes that is for a docker image of grafana. the github repo you are pointing to and having errors for is not for grafana

I’m trying to use Docker to install Grafana and yet that is not a suitable topic?

but you are not installing grafana. you are installing another repo that has nothing to do with grafana. unless i am in need of another cup of coffee

1 Like

The error messages are about the directories that are used by Grafana.

Ok, I’m going to say it more plainly: that repository you keep pointing to is pure crap. It was created by someone either negligent or someone who simply doesn’t understand docker.

First of all, the folder data and data/grafana don’t exist before hand. So obviously you cannot change their permissions. You have to create them manually and change the permission on data/grafana (only this one, because it seems that data/db is used by the other container). And to the grafana folder (again, relative path, in the git repository).

It then works without any issues. Insisting that this is a bug while using some random repository on the internet and asking for the grafana staff to fix this… isn’t cool (I’ve nothing to do with them, just for your own information).

You need to understand the basics of docker. This is all it boils down to.

2 Likes

ok, thanks for your feedback.

1 Like

Well, that repo does use the grafana’s official image. So much is true. But I agree with you.

1 Like

the error messages could have said something about tesla, google, my kitchen sink but that has no direct bearing on tesla, google or my kitchen. :wink:

2 Likes

In a non-development environment at least I would use named volumes though instead of bind mounts. Actually I would used named volumes anyway if I can access them directly. They are located under /var/lib/docker/volumes.

So you could have something ilke:

volumes:
      - questdb-data:/root/.questdb/db

which corresponds then to /var/lib/docker/volumes/questdb-data on the host itself.

1 Like

ok thanks, I will review.

2 Likes

Including all of the necessary prerequisites and fundamental administration knowledge is difficult for any tutorial. I see that you have opened an issue with the tutorial author, so they may be able to provide further assistance.

As @yosiasz and @cretin have described, this is a permissions issue. I recommend reviewing their suggestions, as well as the solution Usman linked in the Grafana issue you opened.

I’m not sure what distribution you’re running so please refer to more specific documentation as needed, but beginning with reviewing Linux file permissions and file structure should be helpful for this and future projects:

Another tip to tackle this is on the command prompt type the command id

for e.g. I am using the root user for running docker-compose file so (It should return 0 for root)

[root@docker loki-stack]# id -u
0

Open your docker-compose file and

in the grafana section just add this line after the image is picked by you;

user: "0"

Then run this docker command;

[root@docker loki-stack]# docker-compose up -d --force-recreate

And it should not return any errors. I did this recently with the latest grafana version 9.0.3

1 Like