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

**URL:** <https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342>\
**Category:** Configuration\
**Tags:** permissions, docker, configuration\
**Created:** [July 6, 2022, 6:21pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342 "2022-07-06T18:21:04Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 13, 2022, 7:07pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/21 "2022-07-13T19:07:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![codingtomusic](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@codingtomusic](https://community.grafana.com/u/codingtomusic)\
**Post date:** [July 13, 2022, 7:10pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/22 "2022-07-13T19:10:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 13, 2022, 7:10pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/23 "2022-07-13T19:10:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![codingtomusic](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@codingtomusic](https://community.grafana.com/u/codingtomusic)\
**Post date:** [July 13, 2022, 7:11pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/24 "2022-07-13T19:11:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cretin](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@cretin](https://community.grafana.com/u/cretin)\
**Post date:** [July 13, 2022, 7:12pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/25 "2022-07-13T19:12:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codingtomusic](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@codingtomusic](https://community.grafana.com/u/codingtomusic)\
**Post date:** [July 13, 2022, 7:13pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/26 "2022-07-13T19:13:30Z")

</div>

ok, thanks for your feedback.

---

<div class="post-metadata">

**Author:** ![cretin](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@cretin](https://community.grafana.com/u/cretin)\
**Post date:** [July 13, 2022, 7:13pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/27 "2022-07-13T19:13:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 13, 2022, 7:14pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/28 "2022-07-13T19:14:17Z")

</div>

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. 😉

---

<div class="post-metadata">

**Author:** ![cretin](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@cretin](https://community.grafana.com/u/cretin)\
**Post date:** [July 13, 2022, 7:20pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/29 "2022-07-13T19:20:32Z")

</div>

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:

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

```

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

---

<div class="post-metadata">

**Author:** ![codingtomusic](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@codingtomusic](https://community.grafana.com/u/codingtomusic)\
**Post date:** [July 13, 2022, 7:21pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/30 "2022-07-13T19:21:49Z")

</div>

ok thanks, I will review.

---

<div class="post-metadata">

**Author:** ![Melody](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Melody](https://community.grafana.com/u/Melody)\
**Post date:** [July 15, 2022, 8:31pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/31 "2022-07-15T20:31:29Z")

</div>

Including all of the necessary prerequisites and fundamental administration knowledge is difficult for any tutorial. I see that you have opened [an issue](https://github.com/questdb/questdb-slack-grafana-alerts/issues/4) 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](https://community.grafana.com/t/new-docker-install-with-persistent-storage-permission-problem/10896/5) Usman linked in the [Grafana issue](https://github.com/grafana/grafana/issues/51931) 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:

- [Classic SysAdmin: Understanding Linux File Permissions](https://linuxfoundation.org/blog/classic-sysadmin-understanding-linux-file-permissions/)
- [Classic SysAdmin: The Linux Filesystem Explained](https://linuxfoundation.org/blog/classic-sysadmin-the-linux-filesystem-explained/)

---

<div class="post-metadata">

**Author:** ![Melody](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Melody](https://community.grafana.com/u/Melody)\
**Post date:** [July 15, 2022, 8:31pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/32 "2022-07-15T20:31:45Z")

</div>

Closed on July 15, 2022, 8:31pm UTC



---

<div class="post-metadata">

**Author:** ![usman.ahmad](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/usman.ahmad/32/29706_2.png) [@usman.ahmad](https://community.grafana.com/u/usman.ahmad)\
**Post date:** [July 31, 2022, 1:04pm UTC](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342/33 "2022-07-31T13:04:32Z")

</div>

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

[Previous page](https://community.grafana.com/t/mkdir-cant-create-directory-var-lib-grafana-plugins-permission-denied/68342.md?page=1)
