fix(bitcoin): stop writing a datadir bitcoin.conf that conflicts with -conf=/tmp/rpc.conf #131

Open
ssmithx wants to merge 0 commits from fix/bitcoin-conf-conflict-crash-loop into main
Collaborator

Since a597c1d9 (bitcoind RPC creds off argv), bitcoin-core and bitcoin-knots
launch bitcoind with -conf=/tmp/rpc.conf and pass all other settings as CLI
args; bitcoind never reads /var/lib/archipelago/bitcoin/bitcoin.conf again.

write_bitcoin_conf, ensure_bitcoin_rpc_config, and bootstrap's
run_bitcoin_rpc_repair were never updated to match — they kept writing/
"repairing" server=/rpcbind=/rpcallowip=/listen= into that datadir file on
every install, reinstall, and service restart. Bitcoin Core's own
datadir-conflict safety check then refuses to start whenever that file
exists alongside an explicit -conf= arg, so the write and every repair
of it directly caused the crash it was trying to prevent.

Also drop the "restart already-running container after bitcoin.conf
repair" adoption-path branch: it assumed bind settings live in that file
and needs a restart to pick them up, which hasn't been true since
a597c1d9 — the running container's CLI args are already correct.

Replaces both writers with remove_stale_bitcoin_conf(), which renames
(not deletes) any leftover file so already-affected nodes self-heal on
next install/restart instead of staying permanently broken.

bitcoin_data_volume_gb is removed as dead code (it only fed the deleted
prune= line in write_bitcoin_conf, itself unused since a597c1d9 hardcoded
-prune=550 in the manifest's small-disk branch).

Investigated after a crash loop on archy-x250-beta; full incident
timeline and patch rationale in bitcoin-conf-crash-patch.md.

Summary

Verification

Checklist

  • Rust formatting/clippy/tests pass when backend code changed.
  • Frontend type-check/build/tests pass when frontend code changed.
  • App manifests validate when app packaging changed.
  • Generated catalogs are updated when manifest-owned catalog fields changed.
  • Docs are updated for user-facing or developer-facing behavior changes.
  • No secrets, generated build outputs, local screenshots, or private host details are included.
Since a597c1d9 (bitcoind RPC creds off argv), bitcoin-core and bitcoin-knots launch bitcoind with -conf=/tmp/rpc.conf and pass all other settings as CLI args; bitcoind never reads /var/lib/archipelago/bitcoin/bitcoin.conf again. write_bitcoin_conf, ensure_bitcoin_rpc_config, and bootstrap's run_bitcoin_rpc_repair were never updated to match — they kept writing/ "repairing" server=/rpcbind=/rpcallowip=/listen= into that datadir file on every install, reinstall, and service restart. Bitcoin Core's own datadir-conflict safety check then refuses to start whenever that file exists alongside an explicit -conf= arg, so the write and every repair of it directly caused the crash it was trying to prevent. Also drop the "restart already-running container after bitcoin.conf repair" adoption-path branch: it assumed bind settings live in that file and needs a restart to pick them up, which hasn't been true since a597c1d9 — the running container's CLI args are already correct. Replaces both writers with remove_stale_bitcoin_conf(), which renames (not deletes) any leftover file so already-affected nodes self-heal on next install/restart instead of staying permanently broken. bitcoin_data_volume_gb is removed as dead code (it only fed the deleted prune= line in write_bitcoin_conf, itself unused since a597c1d9 hardcoded -prune=550 in the manifest's small-disk branch). Investigated after a crash loop on archy-x250-beta; full incident timeline and patch rationale in bitcoin-conf-crash-patch.md. ## Summary <!-- What changed and why? --> ## Verification <!-- Commands run, devices tested, screenshots, or reason testing was not run. --> ## Checklist - [ ] Rust formatting/clippy/tests pass when backend code changed. - [ ] Frontend type-check/build/tests pass when frontend code changed. - [ ] App manifests validate when app packaging changed. - [ ] Generated catalogs are updated when manifest-owned catalog fields changed. - [ ] Docs are updated for user-facing or developer-facing behavior changes. - [ ] No secrets, generated build outputs, local screenshots, or private host details are included.
ssmithx added 1 commit 2026-08-02 09:10:52 +00:00
Since a597c1d9 (bitcoind RPC creds off argv), bitcoin-core and bitcoin-knots
launch bitcoind with -conf=/tmp/rpc.conf and pass all other settings as CLI
args; bitcoind never reads /var/lib/archipelago/bitcoin/bitcoin.conf again.

write_bitcoin_conf, ensure_bitcoin_rpc_config, and bootstrap's
run_bitcoin_rpc_repair were never updated to match — they kept writing/
"repairing" server=/rpcbind=/rpcallowip=/listen= into that datadir file on
every install, reinstall, and service restart. Bitcoin Core's own
datadir-conflict safety check then refuses to start whenever that file
exists alongside an explicit -conf= arg, so the write and every repair
of it directly caused the crash it was trying to prevent.

Also drop the "restart already-running container after bitcoin.conf
repair" adoption-path branch: it assumed bind settings live in that file
and needs a restart to pick them up, which hasn't been true since
a597c1d9 — the running container's CLI args are already correct.

Replaces both writers with remove_stale_bitcoin_conf(), which renames
(not deletes) any leftover file so already-affected nodes self-heal on
next install/restart instead of staying permanently broken.

bitcoin_data_volume_gb is removed as dead code (it only fed the deleted
prune= line in write_bitcoin_conf, itself unused since a597c1d9 hardcoded
-prune=550 in the manifest's small-disk branch).

Investigated after a crash loop on archy-x250-beta; full incident
timeline and patch rationale in bitcoin-conf-crash-patch.md.
This branch is already included in the target branch. There is nothing to merge.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/bitcoin-conf-conflict-crash-loop:fix/bitcoin-conf-conflict-crash-loop
git checkout fix/bitcoin-conf-conflict-crash-loop
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lfg2025/archy#131