mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-13 02:57:44 -05:00
Failed to initialize issue indexer: mkdir data: permission denied in several situations #3339
Closed
opened 2025-11-02 05:09:05 -06:00 by GiteaMirror
·
14 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v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.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
issue/needs-feedback
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#3339
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Frickeldave on GitHub (May 15, 2019).
[x]):Description
i created my own docker image, based on alpine 3.9. I use gitea 1.7.2 currently. The docker-host is a current CentOS.
I have the issue, that it is not possible to update something in a repo and to do merges with the webinterface (i think they belong together). When i try to do that, i get the following messages:
Edit something in the webinterface and commit:
UpdateLocalCopyBranch [branch: master]: git clone master: mkdir data: permission denied (Message appera in web ui)
Try to merge something within the webinterface
[…routers/repo/pull.go:589 MergePullRequest()] [E] Merge: Failed to create dir data/tmp/local-repo/merge-302991419.git: mkdir data: permission denied (Message appear in logfile)
The environment
In the docker image i created a user “appuser” with UID and GID 140000. The gitea binaries are stored in /home/appuser/app, the configuration files are stored in /home/appuser/data. Of course, the appuser has access to both directories. I have a startscript (start.sh) as entrypoint defined. In this startscript i set all needed variables:
I start gitea with /home/appuser/app/gitea -c /home/appuser/data/gitea.ini within the start.sh script.
No i tried to update to gitea 1.8.0 before opening this ticket. Now the server isn't starting anymore within exact the same docker image. The output of the console is
/ $ /home/appuser/app/gitea -c /home/appuser/data/gitea.ini
2019/05/15 14:03:35 [T] AppPath: /home/appuser/app/gitea
2019/05/15 14:03:35 [T] AppWorkPath: /home/appuser/app
2019/05/15 14:03:35 [T] Custom path: /home/appuser/data/custom
2019/05/15 14:03:35 [T] Log path: /home/appuser/data/log
/ $
In the logfile i have the following message:
2019/05/15 14:03:35 [I] Log Mode: File(Debug)
2019/05/15 14:03:35 [I] XORM Log Mode: File(Debug)
2019/05/15 14:03:35 [I] Cache Service Enabled
2019/05/15 14:03:35 [I] Session Service Enabled
2019/05/15 14:03:35 [I] Mail Service Enabled
2019/05/15 14:03:35 [I] Beginning ORM engine initialization.
2019/05/15 14:03:35 [I] ORM engine initialization attempt #1/10...
2019/05/15 14:03:35 [I] ORM engine initialization successful!
2019/05/15 14:03:35 [I] Git Version: 2.20.1
2019/05/15 14:03:35 [...itea/routers/init.go:95 GlobalInit()] [E] Failed to initialize issue indexer: mkdir data: permission denied
In gitea.ini the "APP" and "ROOT" pathes are specified as followed:
STATIC_ROOT_PATH = /home/appuser/app
APP_DATA_PATH = /home/appuser/data
From my point of view the cause of these issues is the same.
I also found issues #4672 and #6398 which are probably related, bot are closed and reference to #6367 which is a complete other topic (from my point of view, possibly i am wrong).
Would be cool to get help here...
Thanks in advance
Dave
@lunny commented on GitHub (May 17, 2019):
Merge pull request should be a known issue.
@Frickeldave commented on GitHub (May 19, 2019):
But as described before, it's not only an issue with pull requests, also with editing in web and with version 1.8.0 during startup...
@lunny commented on GitHub (May 20, 2019):
@Frickeldave I think you should check your filesystem permission since the log said
permission denied.@Frickeldave commented on GitHub (May 20, 2019):
Hi,
that was the first thing i have done. But i think the permissions are not the problem. The path /home/appuser/app and /home/appuser/data is fully writable for the user.
drwxr-sr-x 1 appuser appuser 26 May 17 06:58 .
drwxr-xr-x 1 root root 21 Feb 22 07:57 ..
-rw------- 1 appuser appuser 90 May 20 07:44 .ash_history
-rw-r--r-- 1 appuser appuser 150 May 15 15:29 .bashrc
drwxr-sr-x 1 appuser appuser 16 May 15 15:28 app
drwxr-sr-x 11 appuser appuser 269 May 17 06:49 data
Is it possile, that gitea tries to write to another path?
Regards
Dave
@Frickeldave commented on GitHub (May 22, 2019):
Hi,
any ideas regarding that issue? Any more feedback needed?
Regards
Dave
@zeripath commented on GitHub (May 22, 2019):
The issue indexer path is determined here:
6eb53ac570/modules/setting/indexer.go (L45)AppDataPath is determined here:
6eb53ac570/modules/setting/setting.go (L615)And AppWorkPath is either:
In 1.9 you will be able to set this using the --work-dir option.
Looking at the information you've provided it looks like you need to set GITEA_WORK_DIR=/home/appuser/data
I suggest you shadow Gitea with a script that sets these for you.
@Frickeldave commented on GitHub (May 22, 2019):
Hi,
thank you very much. I already have a wrapper script. In my inital post this is already described:
I have a startscript (start.sh) as entrypoint defined. In this startscript i set all needed variables:
_
export USER=$(whoami)
export USERNAME=$(whoami)
export GITEA_CUSTOM=/home/appuser/data/custom
export GITEA_WORK_DIR=/home/appuser/data
_
I start gitea with /home/appuser/app/gitea -c /home/appuser/data/gitea.ini within the start.sh script.
Regards
Dave
@zeripath commented on GitHub (May 22, 2019):
I don't think your Gitea work dir export is working properly
2019/05/15 14:03:35 [T] AppWorkPath: /home/appuser/app@zeripath commented on GitHub (May 22, 2019):
There's another place things get written to (!) $HOME/gitea-repositories but I can't remember off the top of my head which config that corresponds to.
@Frickeldave commented on GitHub (May 22, 2019):
Possibly. Here is a print from my console output:
_
/ $ echo "" > /home/appuser/data/log/gitea.log
/ $ cat /home/appuser/data/log/gitea.log
/ $ echo $GITEA_WORK_DIR
/home/appuser/data
/ $ /home/appuser/app/gitea web -c /home/appuser/data/gitea.ini
2019/05/22 12:23:36 [T] AppPath: /home/appuser/app/gitea
2019/05/22 12:23:36 [T] AppWorkPath: /home/appuser/data
2019/05/22 12:23:36 [T] Custom path: /home/appuser/data/custom
2019/05/22 12:23:36 [T] Log path: /home/appuser/data/log
/ $ cat /home/appuser/data/log/gitea.log
2019/05/22 12:23:36 [I] Log Mode: File(Info)
2019/05/22 12:23:36 [I] XORM Log Mode: File(Info)
2019/05/22 12:23:36 [I] Cache Service Enabled
2019/05/22 12:23:36 [I] Session Service Enabled
2019/05/22 12:23:36 [I] Beginning ORM engine initialization.
2019/05/22 12:23:36 [I] ORM engine initialization attempt #1/10...
2019/05/22 12:23:36 [I] ORM engine initialization successful!
2019/05/22 12:23:36 [I] Git Version: 2.20.1
2019/05/22 12:23:36 [...itea/routers/init.go:95 GlobalInit()] [E] Failed to initialize issue indexer: mkdir indexers: permission denied
_
As you can see, in the current console session, GITEA_WORK_DIR is set properly. Any other thing i can check?
Attached you will find my gitea.ini file.
Regards
Dave
gitea.ini.zip
@zeripath commented on GitHub (May 22, 2019):
It looks like you've just copied the whole of app.ini.sample as your app.ini... That's unnecessary and a very good way of ending up over-configuring things and perhaps even breaking things.
You should only copy what you need. For example, the log section is not meant to copied over exactly the way you have done - did you read it? I'm also concerned that you say you're using 1.7.2 (or maybe 1.8.0) but that app.ini.sample is the 1.9 sample. (You're definitely not running 1.9 I can tell from the logging.) I would seriously recommend paring down your app.ini so that it represents what you need to configure and only what you need to configure.
Further are you telling me that you're ending up with different configuration between starting gitea on the console and starting it through your start.sh script? If so the problem lies in your start.sh script. Is it possible that your options are being overridden somewhere else? On the admin pages of gitea you should be able to check where it thinks it is looking for things. In particular it will say if GITEA_WORK_DIR is set and/or GITEA_CUSTOM.
You really should also upgrade your Gitea to at least 1.8.1.
@Frickeldave commented on GitHub (May 22, 2019):
Thank you very much for the time you invest.
Currently in 1.8.0 i have the situtation, that gitea isn't starting, therefore i cannot look into the admin page. It just write out the 4 lines at the console i have posted before. In the version 1.7.2 gitea is starting with the same configuration file (1.7.2 is our prod system, 1.8.0 my dev system).
Currently i ran gitea from an interactive console just for testing (and to exclude every issue that should come from the start.sh script). I execute the 4 export command and then run gitea as shown before.
Regarding the app.ini version: I will compare with the 1.8.0 version, and let you know the results here.
@Frickeldave commented on GitHub (Jun 4, 2019):
Fixed the error regarding the failed start of gitea 1.8.0. The default value for ISSUE_INDEXER_PATH and ISSUE_INDEXER_QUEUE_DIR are set to "indexers/issue.bleve / indexers/issue.queue". This works in 1.7.2 but not in 1.8.0. I changed the pathes to an absolute path (/home/appuser/data/indexers/.... )and now the server starts. At next i will try to find out why its not possible to edit files within web editor or do merges within web editor.
@Frickeldave commented on GitHub (Jun 13, 2019):
WIth the previous describes change also the web-based editor as well as pull requests are working now. Closing ticket.