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

23.05: gitea sets custom/conf/app.ini as read-only and fails startup #235442

Open
peperunas opened this issue Jun 1, 2023 · 5 comments
Open

23.05: gitea sets custom/conf/app.ini as read-only and fails startup #235442

peperunas opened this issue Jun 1, 2023 · 5 comments

Comments

@peperunas
Copy link
Contributor

Describe the bug

gitea fails to start as custom/conf/app.ini is not writeable:

2023/06/01 21:15:10 ...s/setting/setting.go:369:CreateOrAppendToCustomConf() [F] error saving to custom config: open /var/lib/gitea/custom/conf/app.ini: permission denied

I tried to make it writeable but it's reset to read-only each time the service starts.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Rebuild the configuration after moving from 22.11 to 23.05

Notify maintainers

@disassembler @kolaente @Ma27 @techknowlogick

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.110, NixOS, 23.05 (Stoat)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.15.0`
 - channels(giulio): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
compilade added a commit to compilade/nixpkgs that referenced this issue Jun 2, 2023
@DeeUnderscore
Copy link
Contributor

I had the same error message that came up during gitea-pre-start (so the ExecStartPre script that the NixOS module uses, not Gitea server proper).

This was because I had LFS enabled by setting services.gitea.settings.server.LFS_START_SERVER = "true", rather than services.gitea.lfs.enable = true.

Prior to 23.05, the NixOS module unconditionally provisioned the LFS token in app.ini during ExecStartPre, while now it only does that if services.gitea.lfs.enable is true. If LFS is enabled and the startup script does not provision the token, Gitea takes it upon itself to provision the token, and fails to write it to app.ini.

Of course, there are other issues that could produce the same error.

@peperunas
Copy link
Contributor Author

What @DeeUnderscore suggested works for me, thank you.

I believe there should be at least a warning or some type of message for the user.

@DeeUnderscore
Copy link
Contributor

We could probably have a warning that comes up when services.gitea.settings.server.LFS_START_SERVER is set but services.gitea.lfs.enable is not. I'm not sure if a straight up assert that fails the build would make sense here, since I can't really imagine why you'd want it this way, but maybe someone has some weird use case.

@Ma27
Copy link
Member

Ma27 commented Jun 9, 2023

A warning should be fine here. Feel free to file a patch for this.

seqizz pushed a commit to seqizz/nixos-config that referenced this issue Jul 31, 2023
@seqizz
Copy link
Contributor

seqizz commented Jul 31, 2023

Another semi-related note:

gitea[9831]: 2023/07/31 22:03:13 cmd/web.go:170:serveInstalled() [E] Unable to update WORK_PATH=/var/lib/gitea to config "/var/lib/gitea/custom/conf/app.ini": failed to save "/var/lib/gitea/custom/conf/app.ini": open /var/lib/gitea/custom/conf/app.ini: permission denied
gitea[9831]: You must set it manually, otherwise there might be bugs when accessing the git repositories.

I couldn't find a similar one on issue list (in this case gitea starts OK but doesn't allow repository pull/push), probably because I am using unstable.gitea package (v1.20.1) on 23.05.

As a nasty workaround, I had to add following to the config:

services.gitea.extraConfig = ''
  [DEFAULT]
  WORK_PATH=/var/lib/gitea
'';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants