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

Permission denied errors after upgrade to 1.16.5 / fails to start #19367

Closed
catinello opened this issue Apr 10, 2022 · 8 comments
Closed

Permission denied errors after upgrade to 1.16.5 / fails to start #19367

catinello opened this issue Apr 10, 2022 · 8 comments
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.

Comments

@catinello
Copy link

catinello commented Apr 10, 2022

Description

After upgrading to 1.16.5 my installation was not coming back up. I'm receiving those errors (see GIST for Log and Doctor output), even though the permissions are correct. Switching to the gitea user allows me to create directories and files in the given paths.

2022/04/10 20:20:47 routers/init.go:131:GlobalInitInstalled() [I] SQLite3 support is enabled
2022/04/10 20:20:47 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: unique-level for repo-archive cfg: queue.LevelUniqueQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"repo-archive-level", WaitOnEmpty:false}, DataDir:"data/data/queues/common", ConnectionString:"", QueueName:""} error: unable to open level db at data/data/queues/common: mkdir data: permission denied
2022/04/10 20:20:47 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2022/04/10 20:20:47 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for push_update cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"push_update-level", WaitOnEmpty:false}, DataDir:"data/data/queues/common", ConnectionString:"", QueueName:""} error: unable to open level db at data/data/queues/common: mkdir data: permission denied
2022/04/10 20:20:47 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for mail cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"mail-level", WaitOnEmpty:false}, DataDir:"data/data/queues/common", ConnectionString:"", QueueName:""} error: unable to open level db at data/data/queues/common: mkdir data: permission denied
2022/04/10 20:20:47 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for notification-service cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"notification-service-level", WaitOnEmpty:false}, DataDir:"data/data/queues/common", ConnectionString:"", QueueName:""} error: unable to open level db at data/data/queues/common: mkdir data: permission denied
2022/04/10 20:20:47 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2022/04/10 20:20:47 cmd/web.go:153:runWeb() [I] PING DATABASE sqlite3
2022/04/10 20:20:47 cmd/web.go:153:runWeb() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2022/04/10 20:20:47 routers/init.go:137:GlobalInitInstalled() [I] ORM engine initialization successful!

This kind of output loops forever.

If you need further information, please let me know.

Gitea Version

1.16.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/catinello/910df81c3dfa131fe347f3a528fa8966

Screenshots

No response

Git Version

2.35.1

Operating System

Void Linux

How are you running Gitea?

Packaged gitea version as a running service. https://github.com/void-linux/void-packages/tree/master/srcpkgs/gitea

Database

SQLite

@techknowlogick
Copy link
Member

It is recommended you use absolute paths because error: unable to open level db at data/data/queues/common: mkdir data: permission denied is looking for data/data/.... The mkdir error is coming from the OS.

@techknowlogick techknowlogick added type/question Issue needs no code to be fixed, only a description on how to fix it yourself. and removed type/bug labels Apr 10, 2022
@catinello
Copy link
Author

Thank you @techknowlogick that fixed the issue.

Setting APP_DATA_PATH to an absolute path.
APP_DATA_PATH = /var/lib/gitea/data

Is there something planned to add an automatic fix or alert to check for absolute paths? I didn't think of path problems, because the gitea doctor did not alert on the check and it worked without issue on the versions before.

$ gitea doctor --all --fix --config /etc/gitea.conf -C /var/lib/gitea/custom/ -w /var/lib/gitea/
[1] Check paths and basic configuration

  • [I] Configuration File Path: "/etc/gitea.conf"
  • [I] Repository Root Path: "/var/lib/gitea/repositories"
  • [I] Data Root Path: "data"
  • [I] Custom File Root Path: "/var/lib/gitea/custom/"
  • [I] Work directory: "/var/lib/gitea/"
  • [I] Log Root Path: "/var/log/gitea"
    OK
    ...

@ericonr
Copy link

ericonr commented May 26, 2022

@catinello would you mind reopening this issue? I believe this was a regression and should at least be documented. I was just bit by it myself.

;APP_DATA_PATH = data

The example config still has it as a relative path, too.

I see you use the Void package, another solution I found for it was to cd into $HOME

ericonr added a commit to void-linux/void-packages that referenced this issue May 26, 2022
- add log service
- cd into $HOME before running: fixes issues with APP_DATA_PATH being a
  relative path, which is the default in the example config. See [1]

  [1] go-gitea/gitea#19367
@silentcodeg
Copy link
Contributor

@ericonr from which Gitea version did you upgrade?

zeripath added a commit to zeripath/gitea that referenced this issue May 26, 2022
There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.

This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.

Ref go-gitea#19367

Signed-off-by: Andrew Thornton <[email protected]>
@catinello
Copy link
Author

Since @zeripath did open a new issue already. I don't think re-opening is still needed? @ericonr

@singuliere
Copy link
Contributor

See https://hostea.org/blog/path-not-found/ for a detailed explanation of this issue.

TorrentofShame pushed a commit to TorrentofShame/void-packages that referenced this issue Jun 3, 2022
- add log service
- cd into $HOME before running: fixes issues with APP_DATA_PATH being a
  relative path, which is the default in the example config. See [1]

  [1] go-gitea/gitea#19367
@ericonr
Copy link

ericonr commented Jun 5, 2022

@silentcodeg I updated from 1.15.8

@silentcodeg
Copy link
Contributor

@ericonr does https://hostea.org/blog/path-not-found/ shed some light as to why this regression happened and how to avoid it in the future in void packages?

techknowlogick pushed a commit that referenced this issue Jun 6, 2022
* Make AppDataPath absolute against the AppWorkPath if it is not

There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.

This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.

Ref #19367

Signed-off-by: Andrew Thornton <[email protected]>

* Add logging

Signed-off-by: Andrew Thornton <[email protected]>

* absolute workpath against pwd instead of app path first

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lunny Xiao <[email protected]>
manfredu pushed a commit to manfredu/void-packages that referenced this issue Jun 29, 2022
- add log service
- cd into $HOME before running: fixes issues with APP_DATA_PATH being a
  relative path, which is the default in the example config. See [1]

  [1] go-gitea/gitea#19367
Eloitor pushed a commit to Eloitor/void-packages that referenced this issue Jul 4, 2022
- add log service
- cd into $HOME before running: fixes issues with APP_DATA_PATH being a
  relative path, which is the default in the example config. See [1]

  [1] go-gitea/gitea#19367
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 24, 2022
…tea#19815)

* Make AppDataPath absolute against the AppWorkPath if it is not

There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.

This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.

Ref go-gitea#19367

Signed-off-by: Andrew Thornton <[email protected]>

* Add logging

Signed-off-by: Andrew Thornton <[email protected]>

* absolute workpath against pwd instead of app path first

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lunny Xiao <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.
Projects
None yet
Development

No branches or pull requests

5 participants