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

Closed
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.
Collaborator

Closing: this fix is already merged in content. It was merged on the pre-import lineage in 08a725ba ("Merge PR #131: stop writing a datadir bitcoin.conf…") and carried into the current main through the 2026-08-12 open-source initial import — remove_stale_bitcoin_conf() is present at core/archipelago/src/api/rpc/package/install.rs (install + reinstall paths) and in bootstrap.rs, with write_bitcoin_conf/ensure_bitcoin_rpc_config removed exactly as this PR proposed. Verified on current main; no further action needed. (The branch had also been re-committed onto the open-source import root, so the PR showed no merge base with main.)

Closing: this fix is already merged in content. It was merged on the pre-import lineage in `08a725ba` ("Merge PR #131: stop writing a datadir bitcoin.conf…") and carried into the current main through the 2026-08-12 open-source initial import — `remove_stale_bitcoin_conf()` is present at core/archipelago/src/api/rpc/package/install.rs (install + reinstall paths) and in bootstrap.rs, with `write_bitcoin_conf`/`ensure_bitcoin_rpc_config` removed exactly as this PR proposed. Verified on current main; no further action needed. (The branch had also been re-committed onto the open-source import root, so the PR showed no merge base with main.)
chaum closed this pull request 2026-08-30 17:59:11 +00:00
Collaborator

Closing: this fix is already merged in content. It was merged on the pre-import lineage in 08a725ba ("Merge PR #131: stop writing a datadir bitcoin.conf...") and carried into the current main through the 2026-08-12 open-source initial import — remove_stale_bitcoin_conf() is present in core/archipelago/src/api/rpc/package/install.rs (install + reinstall paths) and in bootstrap.rs, with write_bitcoin_conf/ensure_bitcoin_rpc_config removed exactly as this PR proposed. Verified on current main; no further action needed. (The branch had also been re-committed onto the open-source import root, so the PR showed no merge base with main.)

Closing: this fix is already merged in content. It was merged on the pre-import lineage in `08a725ba` ("Merge PR #131: stop writing a datadir bitcoin.conf...") and carried into the current main through the 2026-08-12 open-source initial import — `remove_stale_bitcoin_conf()` is present in core/archipelago/src/api/rpc/package/install.rs (install + reinstall paths) and in bootstrap.rs, with `write_bitcoin_conf`/`ensure_bitcoin_rpc_config` removed exactly as this PR proposed. Verified on current main; no further action needed. (The branch had also been re-committed onto the open-source import root, so the PR showed no merge base with main.)

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.