xDirectory 'gitea' already exists but the mode is different. #3079

Closed
opened 2025-11-02 05:00:12 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @stueja on GitHub (Mar 20, 2019).

  • Gitea version (or commit ref): Gitea version 1.7.4 built with go1.12 : bindata, sqlite, pam
  • Git version: git version 2.21.0
  • Operating system: Arch Linux x64
  • Database (use [x]):
    • PostgreSQL
    • [ x ] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [ x ] Not relevant
  • Log gist:

Description

Restarting the system makes gitea complain about permissions being too strict; every 2 seconds

Mar 20 06:54:02 brick systemd[30014]: StateDirectory 'gitea' already exists but the mode is different. (filesystem: 750 StateDirectoryMode: 755)
Mar 20 06:54:02 brick systemd[30014]: LogsDirectory 'gitea' already exists but the mode is different. (filesystem: 750 LogsDirectoryMode: 755)
Mar 20 06:54:02 brick gitea[30014]: 2019/03/20 06:54:02 [...s/setting/setting.go:741 NewContext()] [E] Failed to load custom conf '/etc/gitea/app>
Mar 20 06:54:02 brick systemd[1]: gitea.service: Main process exited, code=exited, status=1/FAILURE
Mar 20 06:54:02 brick systemd[1]: gitea.service: Failed with result 'exit-code'.
Mar 20 06:54:04 brick systemd[1]: gitea.service: Service RestartSec=2s expired, scheduling restart.
Mar 20 06:54:04 brick systemd[1]: gitea.service: Scheduled restart job, restart counter is at 71807.
Mar 20 06:54:04 brick systemd[1]: Stopped Gitea (Git with a cup of tea).
Mar 20 06:54:04 brick systemd[1]: Started Gitea (Git with a cup of tea).

Workaround:

systemctl stop gitea.service
chmod 755 /var/log/gitea
chmod 755 /var/lib/gitea
systemctl start gitea.service

After system restart, however, error messages start again filling the log.

Expected behavior:
gitea should not complain and error out on permissions being too strict. Also, it seems to be the only culprit responsible for changing the folder permissions.

Originally created by @stueja on GitHub (Mar 20, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): Gitea version 1.7.4 built with go1.12 : bindata, sqlite, pam - Git version: git version 2.21.0 - Operating system: Arch Linux x64 - Database (use `[x]`): - [ ] PostgreSQL - [ x ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [ x ] Not relevant - Log gist: ## Description Restarting the system makes gitea complain about permissions being too strict; every 2 seconds ``` Mar 20 06:54:02 brick systemd[30014]: StateDirectory 'gitea' already exists but the mode is different. (filesystem: 750 StateDirectoryMode: 755) Mar 20 06:54:02 brick systemd[30014]: LogsDirectory 'gitea' already exists but the mode is different. (filesystem: 750 LogsDirectoryMode: 755) Mar 20 06:54:02 brick gitea[30014]: 2019/03/20 06:54:02 [...s/setting/setting.go:741 NewContext()] [E] Failed to load custom conf '/etc/gitea/app> Mar 20 06:54:02 brick systemd[1]: gitea.service: Main process exited, code=exited, status=1/FAILURE Mar 20 06:54:02 brick systemd[1]: gitea.service: Failed with result 'exit-code'. Mar 20 06:54:04 brick systemd[1]: gitea.service: Service RestartSec=2s expired, scheduling restart. Mar 20 06:54:04 brick systemd[1]: gitea.service: Scheduled restart job, restart counter is at 71807. Mar 20 06:54:04 brick systemd[1]: Stopped Gitea (Git with a cup of tea). Mar 20 06:54:04 brick systemd[1]: Started Gitea (Git with a cup of tea). ``` Workaround: ``` systemctl stop gitea.service chmod 755 /var/log/gitea chmod 755 /var/lib/gitea systemctl start gitea.service ``` After system restart, however, error messages start again filling the log. Expected behavior: gitea should not complain and error out on permissions being too strict. Also, it seems to be the only culprit responsible for changing the folder permissions. <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/question label 2025-11-02 05:00:12 -06:00
Author
Owner

@lunny commented on GitHub (Mar 20, 2019):

I think that's systemctl's complain but not Gitea's

@lunny commented on GitHub (Mar 20, 2019): I think that's systemctl's complain but not Gitea's
Author
Owner

@stueja commented on GitHub (Mar 20, 2019):

Oh, yes, as you say it, I see that the line begins with systemd. The question is then, where from does systemd get the information that a directory should have a certain mode? I couldn't find anything in app.ini nor in gitea.service.

@stueja commented on GitHub (Mar 20, 2019): Oh, yes, as you say it, I see that the line begins with `systemd`. The question is then, where from does systemd get the information that a directory should have a certain mode? I couldn't find anything in `app.ini` nor in `gitea.service`.
Author
Owner

@stueja commented on GitHub (Mar 22, 2019):

After researching, yes, this is a warning message from systemd.
The real problem, which I observed is that gitea didn't want to start. I thought the permissions were the culpit when in fact they are not. I will research the remaining problem and open a new issue.

@stueja commented on GitHub (Mar 22, 2019): After researching, yes, this is a warning message from `systemd`. The real problem, which I observed is that `gitea` didn't want to start. I thought the permissions were the culpit when in fact they are not. I will research the remaining problem and open a new issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3079