On NixOS 23.05 I’m unable to use sanoid --monitor-* commands (
--monitor-snapshots) on the CLI and in scripts.
This because the configuration file sanoid relies on (by default /etc/sanoid/sanoid.conf) doesn’t exist.
I know that the actual config file used by the sanoid service it’s the one generated by the sanoid derivation, if I do
systemctl cat sanoid I can see:
... ExecStart='/nix/store/mfhah82mjcffc9y7hvx60gpdk2f0183h-sanoid-2.1.0/bin/sanoid' '--cron' '--configdir' '/nix/store/gggb1m057i9x7zqif5sfpv54j8j2hbn4-sanoid.conf' ...
If I do
sanoid --monitor-health --configdir /nix/store/gggb1m057i9x7zqif5sfpv54j8j2hbn4-sanoid.conf
the command behave as expected*.
But I have a health-monitoring script relying on the
sanoid --monitor-health &co commands…For what I can understand the sanoid.conf path will change on the next sanoid update, so it’s rather inconvenient hard-coding that path in the scrip or linking
/etc/sanoid to it.
I was wondering if there is a nice way to handle this situation…
*: actually, it does now, in the previous weeks when I first encountered the problem, I had another error about the inability to create a temp file or something. I’m unable to recreate the problem now, maybe it was a contingent situation (sanoid snapshotting in progress?) or it has been fixed by an update…