fix(nixos): smartd self-gates on the hardware — the doctor was right, smartd wasn't
Some checks failed
Check / eval (push) Has been cancelled

BACKLOG #118. Bernardo booted the live ISO and the Waybar health icon was red,
reporting smartd. Everything downstream turned out to be working correctly,
which is the part worth recording: smartd's config is DEVICESCAN, and where no
drive answers SMART it exits 17 ("Unable to monitor any SMART enabled
devices"), systemd marks the unit failed, nomarchy-doctor faithfully reports a
failed system unit, and Waybar paints @bad. The doctor was telling the truth.
smartd was the bug.

Scope was never live-only, which is why this sat in NOW rather than as a live
nit: services.smartd.enable mkDefaults true on every machine and QEMU virtio
exposes no SMART, so every VM install has been booting to a health warning
about a daemon with nothing to do — and every V2 run had been showing it as
noise.

Fixed with the distro's own self-gate convention: an ExecCondition running
`smartctl --scan`, which prints nothing exactly when smartd would find nothing.
A failed condition leaves the unit inactive rather than failed. Deliberately
NOT SuccessExitStatus = 17: that would also swallow exit 17 from a machine that
does have drives, which is the entire reason the daemon ships.

V2. checks.smartd-gate boots the REAL distro module rather than a restatement
of it (its nixpkgs.config needs mkForce to yield to the test's pkgs) and
asserts both halves, because they pull in opposite directions: a gate that
never skips leaves the red icon, and a gate that always skips silently disables
drive-health monitoring on real hardware — the failure nobody notices until a
disk dies quietly. So the no-SMART node must go ActiveState=inactive, unfailed,
and absent from `systemctl --failed` (what the doctor actually reads); and the
gate's logic is driven against a scan that DOES find a device, since QEMU
cannot answer SMART honestly and pretending otherwise would test nothing. The
check was proved to fail by unwiring the condition. flake check, doctor,
hardware-toggles, live-baseline-apps, option-docs and state-bridges pass.

V3 pending: that smartd still RUNS where drives have SMART (dev box, real
NVMe). Queued with an explicit fail-condition — if it skips there, revert the
gate rather than tune it.

Also swept: #120's size table said the duplicate chromium was gone; #121 was
reverted, so it is back and the table says so.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 17:38:58 +01:00
parent 0727ba6d44
commit 19ba4e2b12
6 changed files with 162 additions and 51 deletions

View File

@@ -19,6 +19,37 @@ Template:
---
## 2026-07-14 — #118: smartd self-gates; the doctor was right all along (this commit)
- **Task:** BACKLOG #118 — Bernardo's live ISO showed a red Waybar health icon
reporting smartd.
- **Did:** smartd's DEVICESCAN finds nothing where no drive answers SMART and
exits **17**, so systemd marks it failed, the doctor honestly reports a
failed unit, and Waybar paints `@bad`. Everything downstream was correct —
**smartd was the bug, not the doctor**. Added an `ExecCondition` running
`smartctl --scan` (empty exactly when smartd would find nothing), so the
unit goes **inactive** rather than failed. NOT `SuccessExitStatus = 17`,
which would also swallow exit 17 on a machine that has drives — the reason
the daemon exists.
- **Scope was never live-only:** smartd mkDefaults true everywhere and QEMU
virtio has no SMART, so every VM install has been booting to a health
warning, and every V2 run had been showing it as noise.
- **Verified:** **V2**`checks.smartd-gate` boots the **real** distro module
(not a restatement of it; `nixpkgs.config` needed `mkForce` to yield to the
test's pkgs) and asserts both halves, since they pull opposite ways: a gate
that never skips leaves the red icon, one that always skips silently kills
drive-health monitoring — the failure nobody notices until a disk dies
quietly. No-SMART node → `ActiveState=inactive`, not failed, absent from
`systemctl --failed` (what the doctor actually reads); and the gate's logic
driven against a scan that *finds* a device → exit 0, because QEMU cannot
answer SMART honestly and pretending otherwise would test nothing. **Proved
to fail** by unwiring the condition. flake check + doctor + hardware-toggles
+ live-baseline-apps + option-docs + state-bridges green.
- **Pending:** **V3** — that smartd still RUNS on real drives (dev box, real
NVMe). Queued with an explicit fail-condition: if it skips there, revert the
gate rather than tune it.
- **Next suggestion:** #119 (`text/plain` names vscode — the last of #94's bug
class), or #95 (Ghostty does not open) at the top of NOW.
## 2026-07-14 — #121 reverted: the fix worked, the gain didn't survive measuring (this commit)
- **Task:** Bernardo's call on #121 (shipped 0b464af, reverted here): *"Let's
leave it honestly. Sounds too much work for a negligible gain."*