database path is not relative to APP_DATA_PATH #1709

Closed
opened 2025-11-02 04:10:35 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @mqus on GitHub (Apr 18, 2018).

Description

On archlinux I installed the gitea-package from AUR and tried to clone a repository over ssh which didn't work and threw an error similar to the one in serv.log:

2018/04/18 22:40:05 [...io/gitea/cmd/serv.go:102 runServ()] [F] setup: Failed to connect to database: Failed to create directories: mkdir data: permission denied

With a bit trial-and-error, I found out that in the app.ini, APP_DATA_PATH was set to /var/lib/gitea but PATH (for databases) was set to data/gitea.db . As gitea serv was run (indirectly) by the git clone command on the client, it searched for the database file in /usr/bin/ instead of /var/lib/gitea (see the strace output linked above) and tried to create a directory there. After I set PATH to an absolute referenced path everything worked, but shouldn't this also work without referencing it absolutely?

This is more of a feature-request than a bug, but it is to promote consistency, as #2192 already adressed similar issues(#1419)

edit:styling

Originally created by @mqus on GitHub (Apr 18, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) 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): 1.4.0 - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: Strace for gitea serv: https://gist.github.com/mqus/4ca46d66a9e9c858ba6af8e115513674 ## Description On archlinux I installed the gitea-package from AUR and tried to clone a repository over ssh which didn't work and threw an error similar to the one in serv.log: ``` 2018/04/18 22:40:05 [...io/gitea/cmd/serv.go:102 runServ()] [F] setup: Failed to connect to database: Failed to create directories: mkdir data: permission denied ``` With a bit trial-and-error, I found out that in the `app.ini`, `APP_DATA_PATH` was set to `/var/lib/gitea` but `PATH` (for databases) was set to `data/gitea.db` . As `gitea serv` was run (indirectly) by the `git clone` command on the client, it searched for the database file in `/usr/bin/` instead of `/var/lib/gitea` (see the strace output linked above) and tried to create a directory there. After I set `PATH` to an absolute referenced path everything worked, but shouldn't this also work without referencing it absolutely? This is more of a feature-request than a bug, but it is to promote consistency, as #2192 already adressed similar issues(#1419) *edit:styling*
GiteaMirror added the type/proposal label 2025-11-02 04:10:35 -06:00
Author
Owner

@hammackj commented on GitHub (Jun 28, 2018):

Had the same error. Setting database path to PATH = /var/lib/gitea/data/gitea.db fixed it for me as stated above.

@hammackj commented on GitHub (Jun 28, 2018): Had the same error. Setting database path to PATH = /var/lib/gitea/data/gitea.db fixed it for me as stated above.
Author
Owner

@yatesco commented on GitHub (Jul 22, 2018):

Another "me too".

@yatesco commented on GitHub (Jul 22, 2018): Another "me too".
Author
Owner

@adymitruk commented on GitHub (Aug 18, 2018):

Same here. Took a couple of hours of my day...

@adymitruk commented on GitHub (Aug 18, 2018): Same here. Took a couple of hours of my day...
Author
Owner

@rossipedia commented on GitHub (Sep 29, 2018):

Just got bit by this. Default SQLite setup running under non-root git user on Ubuntu 18.04

@rossipedia commented on GitHub (Sep 29, 2018): Just got bit by this. Default SQLite setup running under non-root `git` user on Ubuntu 18.04
Author
Owner

@tmikaeld commented on GitHub (Oct 21, 2018):

Another one got bitten, default on Debian 9 was the relative path (data/gitea.db), also user git.

@tmikaeld commented on GitHub (Oct 21, 2018): Another one got bitten, default on Debian 9 was the relative path (data/gitea.db), also user git.
Author
Owner

@mckaygerhard commented on GitHub (Dec 6, 2018):

this problem its due the explained in #5482

@mckaygerhard commented on GitHub (Dec 6, 2018): this problem its due the explained in #5482
Author
Owner

@mqus commented on GitHub (Jul 1, 2020):

Is this still a thing? If it isn't, its not documented, APP_DATA_PATH is not even in here: https://docs.gitea.io/en-us/config-cheat-sheet/. It would be nice if the comment next to that line in the ini file would describe which data will be put into it.

@mqus commented on GitHub (Jul 1, 2020): Is this still a thing? If it isn't, its not documented, APP_DATA_PATH is not even in here: https://docs.gitea.io/en-us/config-cheat-sheet/. It would be nice if the comment next to that line in the `ini` file would describe which data will be put into it.
Author
Owner

@wxiaoguang commented on GitHub (Oct 19, 2022):

According to

Hmm... I think this is solved already.

@wxiaoguang commented on GitHub (Oct 19, 2022): According to * https://github.com/go-gitea/gitea/issues/5482#issuecomment-491940322 > Hmm... I think this is solved already.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1709