NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.21k stars 14.2k forks source link

Nextcloud Memories App logging multiple errors and automatic indexing does not work #345267

Open MartiniMoe opened 1 month ago

MartiniMoe commented 1 month ago

Describe the bug

In Nextclouds Log Viewer I can see multiple errors related to the Memories App:

[PHP] Error: Undefined array key 1 at /nix/store/dwsf1q72543bcv6qfswz47ax08b90fzj-nextcloud-app-memories-7.3.1/lib/Exif.php#440
    from ? by -- at 29.09.2024, 12:19:59
[PHP] Error: proc_open(): posix_spawn() failed: No such file or directory at /nix/store/dwsf1q72543bcv6qfswz47ax08b90fzj-nextcloud-app-memories-7.3.1/lib/Exif.php#435
    from ? by -- at 29.09.2024, 12:19:59
[core] Error: Error while running background job OCA\Memories\Cron\IndexJob (id: 20648, arguments: null)
    from ? by -- at 29.09.2024, 11:59:59

In Memories Admin Page I can see that the automatic indexing does not seem to work properly: image (The App is already installed on my instance for weeks)

Steps To Reproduce

I installed Nextcloud and activated the Memories App like this:

  services.nextcloud = {
    enable = true;
    package = pkgs.nextcloud29;
    [...]
    extraApps = {
      inherit (config.services.nextcloud.package.packages.apps)
        [...]
        memories
      ;
    };
    extraAppsEnable = true;

Expected behavior

I expect the automatic indexing to work properly and the Memories App to not fill my error logs.

Notify maintainers

@Ma27 @onny @teto

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.4, NixOS, 24.05 (Uakari), 24.05.20240927.f651414`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - nixpkgs: `/nix/store/2vmkhm30kdnics1bnj9zgblh9yr4cpyw-source`

Add a :+1: reaction to issues you find important.

Ma27 commented 1 month ago

[PHP] Error: proc_open(): posix_spawn() failed: No such file or directory at /nix/store/dwsf1q72543bcv6qfswz47ax08b90fzj-nextcloud-app-memories-7.3.1/lib/Exif.php#435

This seems like some program is missing in $PATH.

MartiniMoe commented 1 month ago

[PHP] Error: proc_open(): posix_spawn() failed: No such file or directory at /nix/store/dwsf1q72543bcv6qfswz47ax08b90fzj-nextcloud-app-memories-7.3.1/lib/Exif.php#435

This seems like some program is missing in $PATH.

Thank you! I'm sorry, I am kind of clueless here. Do you have any idea what is missing, how to add it or how to narrow the problem down somehow?

MartiniMoe commented 1 month ago

The mentioned line in Exif.php is:

self::$staticProc = proc_open(array_merge(self::getExiftool(), ['-stay_open', 'true', '-@', '-']), [

So maybe it has something to do with Exiftool? I tried adding

systemd.services."phpfpm-nextcloud" = {
  path = [ pkgs.exiftool ];
};

to my config, but the error persists. I'm not even sure if that is the right service and right way to configure the path?

Ma27 commented 1 month ago

So the code here is... kinda interesting: https://github.com/pulsejet/memories/blob/13b81d02955195a6dde6603eee4d48abd0ed8698/lib/Service/BinExt.php#L120C32-L120C58

If memories.exiftool_no_local is true, it does perl ... which may be one explanation (no perl in $PATH of the service).

Given https://github.com/pulsejet/memories/blob/13b81d02955195a6dde6603eee4d48abd0ed8698/lib/Service/BinExt.php#L108-L110

it should work if memories.exiftool_no_local is false and memories.exiftool points to lib.getExe pkgs.exiftool. Both values can be set via services.nextcloud.settings.

Can you report if that solves your problem, please?

But, what a mess. We should probably patch out the entire hackery in there and make it use pkgs.exiftool.

MartiniMoe commented 1 month ago

Thank you! I now have added the following to my config:

services.nextcloud = {
  settings = {
    memories = {
      exiftool_no_local = false;
      exiftool = "${lib.getExe pkgs.exiftool}";
    };
  };
};

But the posix_spawn() error still appears in the logs :(