Cannot backup gitea

I use gitea 1.13.2. If I run gitea dump -c /path/to/app.ini, it failed with following error:

git@ubuntu:/usr/local/bin$ ./gitea dump -c /etc/gitea/app.ini
2021/02/03 19:49:37 ...dules/setting/git.go:91:newGit() [I] Git Version: 2.25.1, Wire Protocol Version 2 Enabled
2021/02/03 19:49:37 ...dules/setting/log.go:297:newLogService() [I] Gitea v1.13.2 built with GNU Make 4.1, go1.15.7 : bindata, sqlite, sqlite_unlock_notify
2021/02/03 19:49:37 ...dules/setting/log.go:343:newLogService() [I] Gitea Log Mode: Console(Console:info)
2021/02/03 19:49:37 ...les/setting/cache.go:70:newCacheService() [I] Cache Service Enabled
2021/02/03 19:49:37 ...les/setting/cache.go:81:newCacheService() [I] Last Commit Cache Service Enabled
2021/02/03 19:49:37 ...s/setting/session.go:63:newSessionService() [I] Session Service Enabled
2021/02/03 19:49:37 ...es/setting/mailer.go:116:newRegisterMailService() [W] Register Mail Service: Mail Service is not enabled
2021/02/03 19:49:37 ...s/storage/storage.go:151:initAttachments() [I] Initialising Attachment storage with type:
2021/02/03 19:49:37 ...les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /usr/local/bin/data/attachments
2021/02/03 19:49:37 ...s/storage/storage.go:145:initAvatars() [I] Initialising Avatar storage with type:
2021/02/03 19:49:37 ...les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /usr/local/bin/data/avatars
2021/02/03 19:49:37 ...s/storage/storage.go:163:initRepoAvatars() [I] Initialising Repository Avatar storage with type:
2021/02/03 19:49:37 ...les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /usr/local/bin/data/repo-avatars
2021/02/03 19:49:37 ...s/storage/storage.go:157:initLFS() [I] Initialising LFS storage with type:
Unable to open gitea-dump-1612378177.zip: open gitea-dump-1612378177.zip: permission denied
2021/02/03 19:49:37 ...les/storage/local.go:43:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/lfs
2021/02/03 19:49:37 cmd/dump.go:171:fatal() [F] Unable to open gitea-dump-1612378177.zip: open gitea-dump-1612378177.zip: permission denied

Permissions are:

root@ubuntu:/var/lib/gitea/data# ls -la
total 36
drwxr-x---  9 git git 4096 Dez  8 16:32 .
drwxr-x---  5 git git 4096 Jul  7  2020 ..
drwxr-xr-x  2 git git 4096 Dez  8 16:32 attachments
drwxr-xr-x  2 git git 4096 Jul  7  2020 avatars
drwxr-xr-x  4 git git 4096 Jul  7  2020 indexers
drwxr-xr-x  2 git git 4096 Jul  7  2020 lfs
drwxr-xr-x  7 git git 4096 Dez  8 16:32 queues
drwxr-xr-x  2 git git 4096 Dez  8 16:32 repo-avatars
drwx------ 15 git git 4096 Dez 26 07:59 sessions

What goes wrong with my instance of gitea?

Regards
Djon

1 Like

Hello, I have the same issue, have you solved it ?

Do you have enough disk space to store the temporary files.

1 Like

First had problems with dump trying to use /usr/local/bin/data so i added APP_DATA_PATH in app.ini and that solved that issue.

Then i get the same problem as OP and im not sure how to solve this as permissions seem OK (same as OP), and /tmp/ has 2.8gb free.

Hello, I have the same issue, have you solved it ?

Nope, sorry… We already have system backup but I wanted to do the manual backup but fore upgrade. Ended up just upgrading but will check if someone posts a solution here.

you are executing this from the path /usr/local/bin. if the user you are executing this as (ie git) does not have WRITE access to /usr/local/bin it will fail with this exact error message.

its probably best todo something like this: cd tmp; /usr/local/bin/gitea dump -c /etc/gitea/app.ini or have gitea installed in a more FHS compliant structure and then: cd tmp; gitea dump -c /etc/gitea/app.ini

You can add the “–work-path” argument to change the working directory to someplace that you had access to. Apparently, the parameter used to be “–work-dir” but it was changed at some point.