Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea produces superfluous file / folder permission errors when installed through snap #27420

Closed
TheFriendlyCoder opened this issue Oct 3, 2023 · 4 comments
Labels

Comments

@TheFriendlyCoder
Copy link

Description

Installing Gitea on Ubuntu Server using snap, it would appear as though the gitea service is unable to manipulate files in any folder on the system other than those in the /var/snap/gitea sub-dir. For example, I have a completely working configuration on my Ubuntu server using all default options. If I change this one line in the app.ini file:

Before:

[database]
/var/snap/gitea/common/data

After:

[database]
/data/gitea/data

and try running the app by doing something like:

su -c "gitea web --port=3005" git

I get a ORM engine initialization attempt #1/10 failed. Error: failed to connect to database: Failed to create directories: mkdir /data: permission denied error.

Even if the /data/gitea/data folder / tree is created in advance, and the git user is set up as the owner, etc. the problem still persists:

mkdir -p /data/gitea/data
chmod -R 0755 /data
chown -R git:git /data

The most notable / strange part of this error is that gitea is complaining about the root folder /data rather than the full path /data/gitea/data, which suggests to me the app is trying to manipulate the root folder of the path for some strange reason, even though - as I've described above - it should have no reason to do so.

Gitea Version

Gitea version 1.20.5 built with GNU Make 4.3, go1.21.1 : bindata, sqlite, sqlite_unlock_notify, pam, cert

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

git version 2.34.1

Operating System

Ubuntu 22.04.3 LTS

How are you running Gitea?

I have tried running the app directly from the command line as the current user (gitea ....), indirectly from the command line as a specific user (ie: su -c "gitea...." git), and indirectly as a systemd service (ie: systemctl start gitea). In all cases the service runs fine with the default app.ini configuration, but changing ANY of the data paths (ie: APP_DATA_PATH, repository->ROOT, etc. etc.) results in the same error being thrown.

Database

SQLite

@TheFriendlyCoder
Copy link
Author

I believe a similar problem with the .ssh config folder was also report here: #25102

@techknowlogick
Copy link
Member

I believe this is intentional on behalf of snap due to their security model, but I'll keep this open in case someone else can provide more insight.

@TheFriendlyCoder
Copy link
Author

If that is the case it may be worth mentioning this somewhere in the docs. I spent hours debugging permission problems with gitea this past week, and all that wasted time could have been avoided with a small footnote somewhere in your docs. :p

lunny pushed a commit that referenced this issue Oct 5, 2023
Fix the title size and add notes to the Gitea snap package.
Related issue #27424, #27423, #27422, #27420
@lng2020
Copy link
Member

lng2020 commented Oct 23, 2023

The doc is updated in 1.21rc. So I am closing two of your three issues with the snap package and leaving that dump cmd issue(The dump command indeed has several bugs). Feel free to reopen if you have other concerns.

@lng2020 lng2020 closed this as completed Oct 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants