From 3bc57ef36bc483c9aaa55453839a880d7b04c0f4 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 5 Jun 2026 15:15:55 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20ZFS-Erkennung=20via=20tats=C3=A4chlichem?= =?UTF-8?q?=20zpool-Test=20statt=20which()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shutil.which() reicht nicht: auf privilegierten LXC-Containern ist zpool installiert, aber /dev/zfs fehlt → Befehl schlägt fehl. _probe_zfs() führt zpool list einmal aus und wertet den Exit-Code aus. Co-Authored-By: Claude Sonnet 4.6 --- backend/services/zfs_runner.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/services/zfs_runner.py b/backend/services/zfs_runner.py index 189e507..7ea7ea9 100644 --- a/backend/services/zfs_runner.py +++ b/backend/services/zfs_runner.py @@ -16,8 +16,17 @@ import re logger = logging.getLogger(__name__) # Detect ZFS availability once at import time — avoids repeated ERROR logs on LXC/non-ZFS systems -import shutil as _shutil -ZFS_AVAILABLE = bool(_shutil.which("zpool")) +# shutil.which is not enough: on privileged LXC containers zpool exists but /dev/zfs is missing +def _probe_zfs() -> bool: + try: + r = subprocess.run(["zpool", "list"], capture_output=True, timeout=3) + return r.returncode == 0 + except (FileNotFoundError, subprocess.TimeoutExpired, OSError): + return False + +ZFS_AVAILABLE = _probe_zfs() +if not ZFS_AVAILABLE: + logger.info("ZFS not available on this system (pools/snapshots disabled)") # Cache with TTL @dataclass