Chown command running issue when gitea starts #2045

Closed
opened 2025-11-02 04:22:14 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @sunsongxp on GitHub (Jul 11, 2018).

  • Gitea version (or commit ref): v1.4.3
  • Git version:
  • Operating system: Docker Mac
  • Database (use [x]):
    • [X ] PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [X ] Not relevant
  • Log gist:

Description

Gitea container was down due to maintenance, then I restart the container, the container is up without problem, but the gitea is not running. I went to inside the container using docker exec, I found that it is all because the container is running chown -R git:git /data/gitea /app/gitea /data/git on every start. Let's say I have quite a number of projects with large repositories, this command will take a long time to finish. After it has finished, gitea is up again without problem.

https://hub.docker.com/r/gitea/gitea/tags/

So here is solution, remove chown step when start, please do not run chown to the whole data folder in any circumstance, it is not a scalable way to manage the data folder

Originally created by @sunsongxp on GitHub (Jul 11, 2018). - Gitea version (or commit ref): v1.4.3 - Git version: - Operating system: Docker Mac - Database (use `[x]`): - [X ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X ] Not relevant - Log gist: ## Description Gitea container was down due to maintenance, then I restart the container, the container is up without problem, but the gitea is not running. I went to inside the container using docker exec, I found that it is all because the container is running `chown -R git:git /data/gitea /app/gitea /data/git` on every start. Let's say I have quite a number of projects with large repositories, this command will take a long time to finish. After it has finished, gitea is up again without problem. https://hub.docker.com/r/gitea/gitea/tags/ So here is solution, remove `chown` step when start, please do not run chown to the whole data folder in any circumstance, it is not a scalable way to manage the data folder
GiteaMirror added the topic/deployment label 2025-11-02 04:22:14 -06:00
Author
Owner

@sunsongxp commented on GitHub (Jul 11, 2018):

It also happens at version v1.5

@sunsongxp commented on GitHub (Jul 11, 2018): It also happens at version v1.5
Author
Owner

@fabian-braun commented on GitHub (Oct 10, 2018):

We encountered the same issue having the respective folders on a slow NFS.
I created a small PR to illustrate how it could be fixed. I'm not a bash expert, don't hesitate to suggest changes / improvements.
Especially I'm not sure if checking the ownership only on the top-level directory is sufficient.

@fabian-braun commented on GitHub (Oct 10, 2018): We encountered the same issue having the respective folders on a slow NFS. I created a small PR to illustrate how it could be fixed. I'm not a bash expert, don't hesitate to suggest changes / improvements. Especially I'm not sure if checking the ownership only on the top-level directory is sufficient.
Author
Owner

@captn3m0 commented on GitHub (Oct 13, 2018):

I'm on 1.5.0-rc1 and facing the same issue.

@captn3m0 commented on GitHub (Oct 13, 2018): I'm on `1.5.0-rc1` and facing the same issue.
Author
Owner

@captn3m0 commented on GitHub (Oct 13, 2018):

I found that the step was hung for me because of a huge sessions directory. I'd long back switched sessions to redis, however the old sessions directory was still taking up 400MB of disk space, and the chown was taking too much time because of that. Deleting the directory, and upgrading to 1.5.2 helped.

@captn3m0 commented on GitHub (Oct 13, 2018): I found that the step was hung for me because of a huge `sessions` directory. I'd long back switched sessions to redis, however the old sessions directory was still taking up 400MB of disk space, and the `chown` was taking too much time because of that. Deleting the directory, and upgrading to `1.5.2` helped.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2045