Skip to content

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

Closed
@TheFriendlyCoder

Description

@TheFriendlyCoder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions