A single racing occ maintenance:install bricks the files node permanently — the half-written config.php poisons every retry into nixpkgs' dead upgrade branch, and the clean-retry cannot clear it #1022
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#1022
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of the heal for drive
20260830T074445Z(red atdeploy-files, sig03a7ed69caec). Commit12676998fixed the ORDERING that let the first install race the postgres socket. This issue is the separate amplifier that turned that one transient race into an unrecoverable node, and it stands whatever fixes the ordering.Failure
On that drive
nextcloud-setup.servicefailed four times, and only the first failure was the race:occ maintenance:installdiesError while trying to create admin account: … SQLSTATE[08006] [7] connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory(logs/droplet-units.txt:102-103, stack at:105-122).Nextcloud is not installed - only a limited number of commands are available/Command "upgrade" is not defined(logs/droplet-journal.txt:1423-1429). Postgres had been listening on/run/postgresqlfor ten minutes by then (logs/droplet-units.txt:65,.postgres-wrapppid 9977 on 127.0.0.1:5432).The node never recovers, and the second wording is the one that reaches the operator — so the real cause is hidden behind a symptom that no amount of retrying can clear.
Evidence for the mechanism
nixpkgs'
nextcloud-setupscript (26.11,nixos/modules/services/web-apps/nextcloud.nix:1446-1450) is:The install-vs-upgrade decision is made solely on
config.phpbeing non-empty, and Nextcloud writesconfig.phpbefore it touches the database — the drive's own stack showsSetup.php(386): OC\Setup\PostgreSQL->setupDatabase()being reached fromInstall.php(82), i.e. after config has been written (logs/droplet-units.txt:113-114). So amaintenance:installthat dies at the DB step leaves a non-empty, never-installedconfig.phpbehind. From then on the guard skips the install forever and$OCC_BIN upgraderuns against an uninstalled instance, which exits 1 every time.switch-to-configurationexits 4 on that, so the whole deploy reds.Same boot also shows the two collateral units this drags down:
nextcloud-update-db.service(There are no commands defined in the "db" namespace, plusCannot write into "config" directory!,logs/droplet-journal.txt:1433-1440) andnextcloud-oidc.service, which retried its idempotent provider config ~40 times over four minutes against an instance that could never exist (logs/droplet-journal.txt:17, 57, …, 1477) before dying at the ceiling. All three are named bysystemctl --failed(logs/droplet-units.txt:2-4).Suspected layer
The files render,
internal/clan/files.go— the same module that ownsrenderNextcloudStore/renderFilesFirstActivation. Nothing in this repo currently guards the install's atomicity; we inherit nixpkgs' guard, and that guard is not crash-safe.What plugging it needs
The node must be able to recover from a failed first install on the next switch, instead of latching. Design ruling needed on which of these the repo wants, because they differ in how destructive they are:
nextcloud-setup(e.g.preStart, orserviceConfig.ExecStartPre) that detects a never-completed install —config.phppresent but no'installed' => true— and removes it so the stock guard re-enters the install branch. Needs care: it must be provably unable to fire against a healthy instance, sinceconfig.phpon a real deployment is data-bearing.maintenance:installreturns 0, with the guard keying off the sentinel rather than offconfig.php).Either way the acceptance criterion is testable at the render level in
internal/clan/files_test.go(sibling toTestRenderFiles_SetupRequiresPostgresTarget), and the behavioural criterion is: after anextcloud-setupfailure at the DB step, the NEXT switch installs cleanly rather than reportingCommand "upgrade" is not defined.Worth noting for whoever picks this up: with commit
12676998in place the ordering race that triggered it should no longer fire, so this is a latent-robustness fix — but it is exactly what cost this drive its clean-retry and a whole paid droplet, and any future first-install hiccup (a slow socket, a vars-not-yet-decrypteddbpassFile, a full disk) re-arms it.drive
20260830T074445Zred atdeploy-files:deploy failed (clean-retry): provision: deploy gateway: clan: deploy failed on 1 node(s): gateway: clan: masked_exit on gateway: clan reported success but the log shows a real failure: the remote switevidence:
/home/dev/swarm/Matou/idss/test-results/drive-idip/20260830T074445Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedswarm-claim host=matou-dev-server-01 run=14398
(automated multi-host claim — lowest live claim id works this ticket)
Ruled by agent under ADR 0174 — veto anytime.
The issue asks for a design ruling between (1) a pre-install guard on
nextcloud-setupthat removes a never-completedconfig.phpso the stock guard re-enters the install branch, and (2) a sentinel file the guard keys off instead ofconfig.php.Ruling: option 1, rendered as a
preStartonnextcloud-setup, keyed on the absence of'installed' => true.if [[ ! -s config.php ]]guard, i.e. overriding the whole setupscript. We inherit that script and only want to make it crash-safe, not fork it.nixos-24.11)nextcloud-setuphas nopreStartof its own and runs asserviceConfig.User = "nextcloud"(owner ofconfig.php), so apreStartwe add merges cleanly and can remove the poisoned file.config.phponly when it is present but lacks'installed' => true— the exact never-completed state Nextcloud leaves whenmaintenance:installdies at the DB step (it writes base config beforesetupDatabase()and only stamps'installed' => trueafter the DB succeeds). A completed, data-bearing instance always carries'installed' => true, so the guard is provably unable to fire against a healthy instance.Why two-way door: revertible by a later commit (it is a
preStartblock in the render); provable by a render test (TestRenderFiles_SetupClearsNeverCompletedInstall, sibling toTestRenderFiles_SetupRequiresPostgresTarget) and behaviourally by the next paiddrive-idipre-greeningdeploy-files. It is not the "data destruction" one-way door: it can only ever delete a config that no data was ever written behind (DB never set up), and never touches a healthy one.close-report for #1022 — status
success⛔ close-report gates REFUSED this close — the following claims did not verify:
baf5fbfba4is not reachable from origin/main (not landed)envelope
close-report for #1022 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope