gnai-ai-backup: Boot-Rennen um den NFS-Mount beheben (RequiresMountsFor)

Befund 09.11.2026: Beim Host-Neustart lief gnai-ai-backup.service um
05:05:45 mit Exit 21, weil /var/lib/ghostnet-pipeline noch nicht gemountet
war. Ursache: Die Service-Unit enthielt After=var-lib-ghostnet-pipeline.mount
- systemd escapt das '-' als \x2d, die reale Mount-Unit heisst
var-lib-ghostnet\x2dpipeline.mount; der literale Name existierte nie
(not-found) und ein blosses After= zieht die Mount-Unit ohne Requires auch
nicht in die Timer-Start-Transaktion.

Fix: RequiresMountsFor={{ ai_backup_nfs_mountpoint }} in der Service-Unit
(ergibt Requires=+After= auf die korrekt escapte Mount-Unit; systemd leitet
den Unit-Namen aus dem Pfad ab). Bei NFS-Ausfall nach Boot schlaegt jetzt die
Mount-Unit fehl und der Service mit Dependency-Fehler statt stillem Exit 21.

Verifiziert 09.11.2026 (Deploy via playbooks/backup.yml, production-Inventar,
ansible-deploy): systemctl show/list-dependencies listen die Mount-Unit unter
Requires=/After=; manueller systemctl start -> Result=success, Archiv
ghostnet-ai-backup-20261109-0544.tar.gz auf dem NFS-Share mit sha256-Sidecar
(sha256sum -c OK, 123 Members, keine *.gguf); Rollen-Zweitlauf changed=0.
Doku: ai_backup-README, GNAI-008 14.6 (Befund als geloest markiert) + Changelog
0.21, GNAI-000 KI-Host-Zeile aktualisiert.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-11-09 05:45:55 +01:00
parent 8ed62ec978
commit 148104de4e
4 changed files with 40 additions and 7 deletions
@@ -26,6 +26,17 @@ before it replaces the last good file; retention keeps the newest
(the timer does this weekly; `systemctl list-timers gnai-ai-backup*`
shows the next run).
- Watch: `journalctl -u gnai-ai-backup.service -n 20`.
- Boot ordering: the service unit carries
`RequiresMountsFor=/var/lib/ghostnet-pipeline`, so every start (including
the Persistent timer run after a reboot) pulls in and waits for the
escaped mount unit `var-lib-ghostnet\x2dpipeline.mount`. The earlier
literal `After=var-lib-ghostnet-pipeline.mount` never matched the escaped
unit name and therefore never ordered anything — at boot on 09.11.2026 the
timer raced the mount and the script exited 21 (GNAI-008 14.6). Fixed and
verified 09.11.2026: `systemctl show` lists the mount unit under
Requires=/After=, a manual `systemctl start` finished with
`Result=success` and produced a sha256-verified archive on the share, and
a second role run reports `changed=0`.
## Restore SOP
@@ -2,8 +2,18 @@
[Unit]
# GNAI-001 M4 configuration backup; target is the NFS pipeline share.
Description=Ghostnet AI configuration backup
After=network-online.target var-lib-ghostnet-pipeline.mount
# RequiresMountsFor derives the correctly escaped mount unit
# (var-lib-ghostnet\x2dpipeline.mount) from the path and adds Requires=+After=,
# so the mount is pulled into every start transaction. A literal
# After=var-lib-ghostnet-pipeline.mount does NOT match the escaped unit name
# and never ordered anything: at boot the Persistent timer raced the mount
# and the script exited 21 (Befund 09.11.2026, GNAI-008 14.6).
RequiresMountsFor={{ ai_backup_nfs_mountpoint }}
After=network-online.target
Wants=network-online.target
# If the NFS export is unreachable at boot, the mount unit fails and this
# service fails with a dependency error instead of silently exiting 21;
# the weekly timer retries on the next scheduled run.
[Service]
Type=oneshot