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

Build failure: Nextcloud datadir change tricks writing config.php #369585

Open
NWuensche opened this issue Dec 31, 2024 · 0 comments
Open

Build failure: Nextcloud datadir change tricks writing config.php #369585

NWuensche opened this issue Dec 31, 2024 · 0 comments
Labels
0.kind: build failure A package fails to build

Comments

@NWuensche
Copy link

Steps To Reproduce

Steps to reproduce the behavior:

  1. build Nextcloud like this
services.nextcloud.enable=true;
services.nextcloud = {
  package = pkgs.nextcloud30;
  hostName = "localhost";
  settings.trusted_domains = ["192.168.1.176"];
  datadir="/home/test/test4";
  config.adminpassFile = "/etc/nextcloud-admin-pass";
};

then, doing sudo nixos-rebuild switch causes no issues, but when opening 192.168.1.176 in the browser, I get the nextcloud screen with the error

Error
Configuration was not read or initialized correctly, not overwriting /home/test/test4/config/config.php

Additional context

. The permissions look like this (config exists, but config.php does not)

drwxr-xr-x  3 root      root       4096 31. Dez 08:01 test4
[test@nixos:~/test4]$ ls -la
total 12
drwxr-xr-x  3 root root  4096 31. Dez 08:01 .
drwx------ 12 test users 4096 31. Dez 08:01 ..
drwxr-xr-x  2 root root  4096 31. Dez 08:01 config
[test@nixos:~/test8/config]$ ls -la
total 8
drwxr-xr-x 2 root root 4096 31. Dez 08:01 .
drwxr-xr-x 3 root root 4096 31. Dez 08:01 ..

. journalctl says the following

Dez 31 08:01:09 nixos php[5862]: Cannot write into "config" directory!
Dez 31 08:01:09 nixos php[5862]: This can usually be fixed by giving the web server write access to the config directory.
Dez 31 08:01:09 nixos php[5862]: But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
Dez 31 08:01:09 nixos php[5862]: See https://docs.nextcloud.com/server/30/go.php?to=admin-config
Dez 31 08:01:09 nixos systemd[1]: Started nextcloud-update-db.service.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5868]: Cannot write into "config" directory!
Dez 31 08:01:09 nixos nextcloud-update-db-start[5868]: This can usually be fixed by giving the web server write access to the config directory.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5868]: But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5868]: See https://docs.nextcloud.com/server/30/go.php?to=admin-config
Dez 31 08:01:09 nixos nixos[5513]: finished switching to system configuration /nix/store/g8hz5rj0k7hldx24205vqh4mdik79c3c-nixos-system-nixos-24.11.711934.4005c3ff7505
Dez 31 08:01:09 nixos systemd[1]: nixos-rebuild-switch-to-configuration.service: Deactivated successfully.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5869]: Cannot write into "config" directory!
Dez 31 08:01:09 nixos nextcloud-update-db-start[5869]: This can usually be fixed by giving the web server write access to the config directory.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5869]: But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
Dez 31 08:01:09 nixos nextcloud-update-db-start[5869]: See https://docs.nextcloud.com/server/30/go.php?to=admin-config

Interesstingly, when I change the datadir in the config to datadir="/var/lib/test4"; and then do sudo nixos-rebuild switch, it creates the config.php without any issues, that is, opening the ip in the browser shows me hte login prompt rather than the error message. Is home maybe not having the correct permissions for some reason?

Metadata

test@nixos:~]$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.02 MiB download, 0.06 MiB unpacked):
  /nix/store/m1p78gqlc0pw3sdbz3rdhklzm0g26g96-stdenv-linux
copying path '/nix/store/m1p78gqlc0pw3sdbz3rdhklzm0g26g96-stdenv-linux' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.67, NixOS, 24.11 (Vicuna), 24.11.711934.4005c3ff7505`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.10`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Notify maintainers

paging maintainers @bachp @schneefux @globin @Ma27


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

1 participant