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

Nextcloud unhandled exception is thrown by nextcloud-setup.service relating to missing locales. #332025

Closed
mannp opened this issue Aug 3, 2024 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@mannp
Copy link
Contributor

mannp commented Aug 3, 2024

Describe the bug

An unhandled exception is thrown relating to locales while using en_GB locale.

Steps To Reproduce

Install nextcloud 29.0.4 on a machine using a en_GB locale.

      services.nextcloud = {
        enable = true;
        package = pkgs.nextcloud29;
        hostName = "nextcloud.domain.com";
        https = true;
        settings.overwriteProtocol = "https";
        autoUpdateApps.enable = true;
        autoUpdateApps.startAt = "05:00:00";
        config = {
          dbtype = "pgsql";
          dbuser = "nextcloud";
          dbhost = "/run/postgresql";
          dbname = "nextcloud";
          adminpassFile = config.sops.secrets."nextcloud/admin-password".path;
          adminuser = "admin";
        };
        /*settings = {
          overwriteprotocol = "https";
          default_phone_region = "GB";
          default_locale = "en_GB";
          force_locale = "en_GB"; 
          default_timezone = "Europe/London";
        };*/
        /*extraOptions = {
          default_locale = "en_GB";
          force_locale = "en_GB"; 
          default_timezone = "Europe/London";
        };*/
      };    

I have tried with the commented out config included, but they do not make a difference 
{ lib, ... }: {
  i18n = {
    defaultLocale = lib.mkDefault "en_GB.UTF-8";
    extraLocaleSettings = {
      LC_ADDRESS = "en_GB.UTF-8";
      LC_IDENTIFICATION = "en_GB.UTF-8";
      LC_MEASUREMENT = "en_GB.UTF-8";
      LC_MONETARY = "en_GB.UTF-8";
      LC_NAME = "en_GB.UTF-8";
      LC_NUMERIC = "en_GB.UTF-8";
      LC_PAPER = "en_GB.UTF-8";
      LC_TELEPHONE = "en_GB.UTF-8";
      LC_TIME = "en_GB.UTF-8";
      LC_ALL  = "en_GB.UTF-8";
      LANG  = "en_GB.UTF-8";
    };
    supportedLocales = [ "en_GB.UTF-8/UTF-8" ];
  };
  time.timeZone = "Europe/London";
}    

Expected behavior

Nextcloud install would proceed as expected

Screenshots

Not applicable

Additional context

Aug 03 16:56:58 gc3 systemd[1]: Starting nextcloud-setup.service...
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: Nextcloud is not installed - only a limited number of commands are available
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed.
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: Please install one of these locales on your system and restart your web server.
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: An unhandled exception has been thrown:
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: Exception: Environment not properly prepared. in /nix/store/7aqs9f3c3pgaqcxlyyb03jg9jkvga2xr-nextcloud-29.0.4/lib/private/Console/Application.php:167
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: Stack trace:
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: #0 /nix/store/7aqs9f3c3pgaqcxlyyb03jg9jkvga2xr-nextcloud-29.0.4/console.php(101): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: #1 /nix/store/7aqs9f3c3pgaqcxlyyb03jg9jkvga2xr-nextcloud-29.0.4/occ(11): require_once('/nix/store/7aqs...')
Aug 03 16:56:58 gc3 nextcloud-setup-start[76211]: #2 {main}
Aug 03 16:56:58 gc3 systemd[1]: nextcloud-setup.service: Main process exited, code=exited, status=1/FAILURE
Aug 03 16:56:58 gc3 systemd[1]: nextcloud-setup.service: Failed with result 'exit-code'.
Aug 03 16:56:58 gc3 systemd[1]: Failed to start nextcloud-setup.service.

Notify maintainers

@schneefux @bachp @globin @Ma27

Metadata

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

  • system: "x86_64-linux"
  • host os: Linux 6.6.32-hardened1, NixOS, 24.11 (Vicuna), 24.11.20240802.42015a1
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.23.3
  • nixpkgs: /nix/store/faz38jpdmx4xmi5irm4v3jzmgnvz8hwv-source
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here
  • system: "x86_64-linux"
  • host os: Linux 6.6.32-hardened1, NixOS, 24.11 (Vicuna), 24.11.20240802.42015a1
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.23.3
  • nixpkgs: /nix/store/faz38jpdmx4xmi5irm4v3jzmgnvz8hwv-source

Add a 👍 reaction to issues you find important.

@mannp mannp added the 0.kind: bug Something is broken label Aug 3, 2024
@Ma27
Copy link
Member

Ma27 commented Aug 5, 2024

I think the problem is supportedLocales: Nextcloud tries to do setlocale against different locales in its install process: https://github.com/nextcloud/server/blob/8511b89579b761798ea4f6ecf9257cad8d0bc462/lib/private/legacy/OC_Util.php#L931

I'm not sure why it's doing that in your case, but I'd suggest to not set supportedLocales and try again.

@mannp
Copy link
Contributor Author

mannp commented Aug 5, 2024

Thanks for taking the time to come back to me; that resolved it.

    supportedLocales = lib.mkMerge [
      (lib.mkIf (config.networking.hostName == "nc-server") [ "en_GB.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" ])
      (lib.mkIf (config.networking.hostName != "nc-server") [ "en_GB.UTF-8/UTF-8" ])
    ];

Hopefully my logic is correct :)

@mannp mannp closed this as completed Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants