Background
I am creating the configuration for services.paperless with the following configuration:
services.paperless = {
enable = true;
extraConfig = { PAPERLESS_OCR_LANGUAGE = "fin+eng"; };
address = "0.0.0.0";
port = 28981;
consumptionDir = "/mnt/share/scanned-documents-copy";
consumptionDirIsPublic = true;
};
However, the “/mnt/share/” is a CIFS-mount configured as such:
let
automount_opts =
"x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,_netdev,noperm";
omv_ip = "***";
hass_ip = "***";
credentials_opt = "credentials=***";
hass_credentials_opt =
"credentials=***";
in _:
{
fileSystems."/mnt/share" = {
device = "//${omv_ip}/omvshare";
fsType = "cifs";
options = [ "${automount_opts},${credentials_opt}" ];
};
}
Expected outcome
I would expect “/mnt/share/scanned-documents-copy” to be useable by the service as its consumption directory.
Outcome
The systemd service fails with the including the following messages:
Detected autofs mount point /mnt/share during canonicalization of /mnt/share/scanned-documents-copy.
Skipping /mnt/share/scanned-documents-copy
Detected autofs mount point /mnt/share during canonicalization of /mnt/share/scanned-documents-copy.
Skipping /mnt/share/scanned-documents-copy
and from paperless-scheduler.service logs:
Nov 05 19:43:21 nixosvm systemd[1475046]: paperless-scheduler.service: Failed to set up mount namespacing: /run/systemd/unit-root/mnt/share/scanned-documents-copy: No such file or directory
Nov 05 19:43:21 nixosvm systemd[1475046]: paperless-scheduler.service: Failed at step NAMESPACE spawning /nix/store/5acfclrp6klap03ikqb6q5vpp1xwql38-unit-script-paperless-scheduler-pre-start/bin/paperless-scheduler-pre-start: No such file or directory
Further info
No doubt this is related to systemd
hardening (and less so to NixOS
) but I found no direct solutions to this and lack the knowledge of systemd
to solve it myself. I would expect similar issues might happen with other services trying to use e.g., CIFS
mounts, so some documentation on the solution would be nice.
The mount works otherwise and with e.g., the syncthing
service. What is different with paperless
? (I suppose the consumption directory is in BindPaths
?)