Gitea installed from snap gitea dump doesnt work

Installed gitea from snapd in ubuntu. (Gitea v1.14.6 Ubuntu 20.04.3)
Configured with MySQL as database.
First access of gitea web interface i left it at run as root as this was prefilled.

Now its just getting the gitea dump command to work…

I have tried numerous versions of the command gitea dump -c /path/to/app.ini
But it always fails with: cmd/dump.go:150:fatal() [F] Unable to open open permission denied

The funny thing is I can get it to fail in a more spectacular way… If i go to the folder /var/snap/gitea/common and execute sudo gitea dump then the dump starts but the zipfile never stops growing… Stopped at 14GB file by hitting ctrl-c

Any pointers on what needs to be done…?


The main issue for you, I think, is that you are running the gitea command such that it is executing and trying to output the dump where the binary resides. This is usually /usr/local/bin for a binary install (sorry, I’ve not used the snap install version, but the issue is the same).

Basically, what is happening when you do this, is that there are no write permissions for the output zip file in the directory where the binary resides.

My process for making it work is the following. I log in as the user that Gitea runs as (again, I’ve used the binary install, and as such I have the user git. In the home directory of the git user, I create a directory and then change into it:

mkdir dump
cd dump

Next I find out the path of the installed version of Gitea:

which gitea
# The output on my system is /usr/local/bin/gitea ; yours may differ!

and in the directory I just created, make a symbolic link to the Gitea binary.

ln -s /usr/local/bin/gitea ./gitea

You will now have a local executable in your writable dump directory. Now run the dump command, pointing at your particular configuration file for Gitea (on my server it is /etc/gitea/app.ini:

./gitea dump -c /etc/gitea/app.ini

The ./ is important; it says to execute the instance of the gitea binary which appears in the current directory. As the directory is writable, you should be able to complete your dump. Not sure why the sudo version of the command would cause the enormous file (unless your repos are enormous).

Anyhow, I hope this helps. I have this directory set up on my server, with the symbolic link, and I can then run a cron job every 12 hours to back up the Gitea instance.


Thanks for the suggestions but seems to be some kinks using snap…

But after your suggestions desperation mode entered and if I change symlink to this:
ln -s /snap/gitea/current/gitea ./gitea
Then it seems to work…

thanks for the awesome information.