title = "[solved] Gitea 1.15 and up: path not found or permission denied"
date = 2022-05-28
description = "After migrating from 1.15 or earlier to gitea 1.16 paths are no longer found and files cannot be created because of permission problems because the default example.ini file changed."
In Gitea 1.15 the [app.example.ini](https://github.com/go-gitea/gitea/blob/cfb4c23a5009b9c236d48ac0bc156577c7d70741/custom/conf/app.example.ini) file was changed to [comment out most of the values](https://github.com/go-gitea/gitea/commit/4a84022d2559ccfc99960c7c654ee8b9b38664f7). The assumption was that all values exactly matched the defaults [in the source code](https://github.com/go-gitea/gitea/blob/main/modules/setting/setting.go). However, there are differences, for instance for [APP_DATA_PATH](https://github.com/go-gitea/gitea/blob/cfb4c23a5009b9c236d48ac0bc156577c7d70741/modules/setting/setting.go#L771). Before Gitea 1.15, `app.example.ini` contained:
```
APP_DATA_PATH = data
```
and the path was relative to the **directory from which the Gitea server was running**. In Gitea 1.15 up to 1.16, it was commented out:
```
; APP_DATA_PATH = data
```
and the path was relative to the **work path directory**, as provided either via the --work-path argument or the `GITEA_WORK_DIR` environment variable.
When a distribution such as voidlinux [uses app.example.ini](https://github.com/void-linux/void-packages/blob/master/srcpkgs/gitea/patches/config.patch) as a base for the Gitea package, this change indirectly creates a regression and an upgrade of Gitea [fails with errors](https://github.com/go-gitea/gitea/issues/19367) such as `unable to open level db at data/data/queues/common: mkdir data: permission denied`. The regression did not show as soon as Gitea 1.15 became available in voidlinux because the package [explicitly set `APP_DATA_PATH`](https://github.com/void-linux/void-packages/blob/7fc9190f0e0d557dd5031e68df4e183892d4315b/srcpkgs/gitea/patches/config.patch#L62). But this [changed when Gitea 1.15.6 was packaged](https://github.com/void-linux/void-packages/commit/19d986a2cae9ce73d32552ddb62443b5e7fa13e2) and once the value was commented out, upgrading triggered the problem. This was worked around six month later with the [Gitea 1.16.8](https://github.com/void-linux/void-packages/commit/44b6c96fa12ce9d993c7a2ac9486d892735b7e3a) package.
The `APP_DATA_PATH` directory is not the only one, the `[log] ROOT_PATH` is another example. There is an [ongoing effort](https://github.com/go-gitea/gitea/pull/19815) to improve the situation in Gitea 1.17. With the downside of introducing breaking changes that will have an impact on all Gitea installations because the content of the `app.ini` file will be interpreted differently. In the case of `APP_DATA_PATH`, both:
```
APP_DATA_PATH = data
```
and:
```
; APP_DATA_PATH = data
```
will be interpreted to be relative to the **work path directory**, as provided either via the --work-path argument or the `GITEA_WORK_DIR` environment variable. Every Gitea installation using **APP_DATA_PATH = data** will need to update the value to be an absolute path such as **/var/lib/gitea/data** so that it keeps pointing to the expected directory.
In order to prepare for the change or ensure the consistency of all path, there fortunately is a very simple **solution: always use absolute paths in the `app.ini` configuration file**.