CT130 self-check, already deployed on CT130 (2026-11-29) and running every 60 s.
Problem: on 2026-11-26 the CT's ext4 images went emergency_ro; nginx served cached files but answered an EMPTY reply (curl 52) for uncached ones, so clients' dnf failed instead of falling back. Fix: when unhealthy, stop nginx + docker-registry so clients get connection refused (<1 s fallback).
Checks: / and /srv/cache rw; write+fsync+delete on both; refresh-fetch of a tiny metadata file through nginx (10 s, one retry). Origin also unreachable = only a warning.
Alert: Kuma monitors 53/54 go DOWN because the services are stopped (no webhook exists on CT130; none invented).
Recovery: only for services it stopped; 3 healthy runs + nginx -t, then start + re-check fetch. Never fsck/remount.
Test: scripts/tests/pkgcache-selfcheck.test.sh (14 cases with fakes; the real read-only bind-mount case runs when mounting is permitted). Live on CT130: read-only /sys as a check path triggered the stop path, 3 runs recovered, a failing fetch with a reachable origin triggered the stop path.
CT130 self-check, already deployed on CT130 (2026-11-29) and running every 60 s.
Problem: on 2026-11-26 the CT's ext4 images went emergency_ro; nginx served cached files but answered an EMPTY reply (curl 52) for uncached ones, so clients' dnf failed instead of falling back. Fix: when unhealthy, stop nginx + docker-registry so clients get connection refused (<1 s fallback).
- Checks: `/` and `/srv/cache` rw; write+fsync+delete on both; refresh-fetch of a tiny metadata file through nginx (10 s, one retry). Origin also unreachable = only a warning.
- Alert: Kuma monitors 53/54 go DOWN because the services are stopped (no webhook exists on CT130; none invented).
- Recovery: only for services it stopped; 3 healthy runs + `nginx -t`, then start + re-check fetch. Never fsck/remount.
- Test: `scripts/tests/pkgcache-selfcheck.test.sh` (14 cases with fakes; the real read-only bind-mount case runs when mounting is permitted). Live on CT130: read-only `/sys` as a check path triggered the stop path, 3 runs recovered, a failing fetch with a reachable origin triggered the stop path.
Do not merge: review pending.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
pkg-cache/pkgcache-selfcheck.{sh,service,timer}: every 60 s check rw mounts, write+fsync+delete
and a fresh fetch through nginx; on failure stop nginx + registry so clients fail over to the
origin instantly (connection refused); restart after 3 healthy runs + nginx -t. Never fsck.
Alert = Uptime Kuma monitors 53/54 going DOWN. Deployed on CT130 2026-11-29.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
The marker branch left a manually/otherwise restarted nginx running unchecked
while the disks were still bad. Now a running nginx with our marker present is
judged like normal operation (stopped again if unhealthy). The test systemctl
fake always returned 0 for is-active, hiding the admin-stopped branch; fixed,
and the tests now pin PKGCACHE_SERVICES and cover the empty-list case.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
Independent review: no HIGH/MEDIUM left after fixes. Tests (14 -> 17 cases, 0 fail; real ro bind-mount case skipped here, needs sudo) and shellcheck -S warning clean.
Checked:
Empty/unset services: ${PKGCACHE_SERVICES-default} (no colon), so only UNSET means the real services and an empty value manages nothing. Never "all". Tests now pin the variable explicitly and cover the empty case.
Flapping: a fetch failure is retried after 3 s, then the origin is fetched directly; only "nginx failed twice AND origin reachable" stops services. Origin also down = warn only (rc 2). A single failed fetch never stops anything. Disk checks (ro mount, write+fsync) stop on one failure by design.
Recovery only for what it stopped (marker), 3 healthy runs + nginx -t + re-fetch, stops again if that fails; never fsck/remount.
State: /run/pkgcache-selfcheck (tmpfs, root, 0755, lock+status+stopped+okcount). Lost on reboot, which is fine: systemd starts nginx and the next run judges it.
Fighting: on CT130 nginx and docker-registry are Restart=no and nothing in cron.d/hourly/systemd/usr/local starts them.
Live CT130 files (script, service, timer) are byte-identical (sha256) to the PR as first reviewed; timer active.
Fixed (bd685f7), a code defect that makes the live copy differ from the branch now:
MEDIUM: if something else started nginx while our stop marker existed, the marker branch left it running unchecked while the disks were still bad. Now a running nginx with our marker is judged like normal operation (stopped again if unhealthy; marker cleared if healthy).
Test fake systemctl is-active always returned 0 (trailing exit 0), so the "admin-stopped nginx is left alone" case was vacuous. Fixed; the case is real now.
Remaining LOW, not changed: rm of the probe file is under timeout but a D-state CIFS hang can outlive it (TimeoutStartSec=120 then kills the unit, services stay up); one failed disk check stops immediately without a retry.
The live CT130 copy needs updating with pkg-cache/pkgcache-selfcheck.sh from bd685f7 (not done by me).
Independent review: no HIGH/MEDIUM left after fixes. Tests (14 -> 17 cases, 0 fail; real ro bind-mount case skipped here, needs sudo) and shellcheck -S warning clean.
Checked:
- Empty/unset services: `${PKGCACHE_SERVICES-default}` (no colon), so only UNSET means the real services and an empty value manages nothing. Never "all". Tests now pin the variable explicitly and cover the empty case.
- Flapping: a fetch failure is retried after 3 s, then the origin is fetched directly; only "nginx failed twice AND origin reachable" stops services. Origin also down = warn only (rc 2). A single failed fetch never stops anything. Disk checks (ro mount, write+fsync) stop on one failure by design.
- Recovery only for what it stopped (marker), 3 healthy runs + nginx -t + re-fetch, stops again if that fails; never fsck/remount.
- State: /run/pkgcache-selfcheck (tmpfs, root, 0755, lock+status+stopped+okcount). Lost on reboot, which is fine: systemd starts nginx and the next run judges it.
- Fighting: on CT130 nginx and docker-registry are Restart=no and nothing in cron.d/hourly/systemd/usr/local starts them.
- Live CT130 files (script, service, timer) are byte-identical (sha256) to the PR as first reviewed; timer active.
Fixed (bd685f7), a code defect that makes the live copy differ from the branch now:
1. MEDIUM: if something else started nginx while our stop marker existed, the marker branch left it running unchecked while the disks were still bad. Now a running nginx with our marker is judged like normal operation (stopped again if unhealthy; marker cleared if healthy).
2. Test fake `systemctl is-active` always returned 0 (trailing `exit 0`), so the "admin-stopped nginx is left alone" case was vacuous. Fixed; the case is real now.
Remaining LOW, not changed: `rm` of the probe file is under `timeout` but a D-state CIFS hang can outlive it (TimeoutStartSec=120 then kills the unit, services stay up); one failed disk check stops immediately without a retry.
The live CT130 copy needs updating with pkg-cache/pkgcache-selfcheck.sh from bd685f7 (not done by me).
jknapp
merged commit 143f05170e into trunk2026-11-29 15:32:27 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
CT130 self-check, already deployed on CT130 (2026-11-29) and running every 60 s.
Problem: on 2026-11-26 the CT's ext4 images went emergency_ro; nginx served cached files but answered an EMPTY reply (curl 52) for uncached ones, so clients' dnf failed instead of falling back. Fix: when unhealthy, stop nginx + docker-registry so clients get connection refused (<1 s fallback).
/and/srv/cacherw; write+fsync+delete on both; refresh-fetch of a tiny metadata file through nginx (10 s, one retry). Origin also unreachable = only a warning.nginx -t, then start + re-check fetch. Never fsck/remount.scripts/tests/pkgcache-selfcheck.test.sh(14 cases with fakes; the real read-only bind-mount case runs when mounting is permitted). Live on CT130: read-only/sysas a check path triggered the stop path, 3 runs recovered, a failing fetch with a reachable origin triggered the stop path.Do not merge: review pending.
🤖 Generated with Claude Code
https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
pkg-cache/pkgcache-selfcheck.{sh,service,timer}: every 60 s check rw mounts, write+fsync+delete and a fresh fetch through nginx; on failure stop nginx + registry so clients fail over to the origin instantly (connection refused); restart after 3 healthy runs + nginx -t. Never fsck. Alert = Uptime Kuma monitors 53/54 going DOWN. Deployed on CT130 2026-11-29. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6Independent review: no HIGH/MEDIUM left after fixes. Tests (14 -> 17 cases, 0 fail; real ro bind-mount case skipped here, needs sudo) and shellcheck -S warning clean.
Checked:
${PKGCACHE_SERVICES-default}(no colon), so only UNSET means the real services and an empty value manages nothing. Never "all". Tests now pin the variable explicitly and cover the empty case.Fixed (
bd685f7), a code defect that makes the live copy differ from the branch now:systemctl is-activealways returned 0 (trailingexit 0), so the "admin-stopped nginx is left alone" case was vacuous. Fixed; the case is real now.Remaining LOW, not changed:
rmof the probe file is undertimeoutbut a D-state CIFS hang can outlive it (TimeoutStartSec=120 then kills the unit, services stay up); one failed disk check stops immediately without a retry.The live CT130 copy needs updating with pkg-cache/pkgcache-selfcheck.sh from
bd685f7(not done by me).