Zoneminder service exit code 127

zoneminder service seems to be broken; repeating ‘zmc -m 1’ exited abnormally, exit status 127 in the logs.

I can reproduce that error code with more detail like this:

 sudo -u zoneminder /nix/store/xpg5yp0796la0h69fzljyrybrvram5d2-zoneminder-1.36.15/bin/zmc -m 1 || echo $?
/nix/store/xpg5yp0796la0h69fzljyrybrvram5d2-zoneminder-1.36.15/bin/zmc: error while loading shared libraries: libmariadb.so.3: cannot open shared object file: No such file or directory
127

I’m able to run zmc -m 1 fine when I enter nix-shell -p zoneminder first, so I think the systemd failure nay be due to the same issue. How can I reconfigure the service to add the dependency correctly ?

If you do ldd ./result/bin/zmc you will see the following line libmariadb.so.3 => not found

That is probably because you have somehow the mariadb library in your environment.

just to confirm… yes - ldd says not found
oddly:

[nix-shell:/]$ ldd /nix/store/r2nla9xks04hq4h1qc51i08y0h7sik6i-zoneminder-1.36.15/bin/zmc | grep mar
        libmariadb.so.3 => /nix/store/3c8zhwsbnvp5xivl7lfq1dg0zbp8fj3k-mariadb-connector-c-3.2.5/lib/mysql/libmariadb.so.3 (0x00007f9dae0cd000)

[nix-shell:/]$ ldd /nix/store/xpg5yp0796la0h69fzljyrybrvram5d2-zoneminder-1.36.15/bin/zmc | grep mar
        libmariadb.so.3 => not found

let’s see if your fix works!
thanks

Brad, please note that ZM is currently lacking a maintainer on NixOS, so if you have the capacity and interest, I’m sure whoever else is using it will be grateful.

I’m not sure I have the expertise… but I can give it a try if people are willing to help…
e.g.
i’m not sure how to test sandro’s fix in my system… what’s the best way to test before the PR gets merged?

Clone the nixpkgs repo, checkout the branch your system is build with, cherry-pick the commit onto and then rebuild your system with that.