From 4d15c92944280312d47198d6861918b3316784bf Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Thu, 30 Jul 2026 18:19:43 -0500 Subject: bitcoind: harden the service unit for boot and shutdown - order after network-online: rpcbind fails with getaddrinfo errors when bitcoind starts before addresses are configured - restart on failure so a transient bad start heals itself - 30min stop timeout: the chainstate flush can far exceed systemd's 90s default, and a SIGKILL there risks a slow replay or a reindex --- bitcoind/templates/bitcoind.service.j2 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bitcoind') diff --git a/bitcoind/templates/bitcoind.service.j2 b/bitcoind/templates/bitcoind.service.j2 index 7c4525a..9106b41 100644 --- a/bitcoind/templates/bitcoind.service.j2 +++ b/bitcoind/templates/bitcoind.service.j2 @@ -1,12 +1,22 @@ [Unit] Description=bitcoind -After=network.target +# network-online (not network): rpcbind to the host address fails with +# getaddrinfo errors if bitcoind starts before addresses are configured +Wants=network-online.target +After=network-online.target [Service] ExecStart=/usr/local/bin/bitcoind{% if bitcoind_reindex %} -reindex{% endif %} User={{bitcoind_user}} +Restart=on-failure +RestartSec=30 + +# chainstate flush on shutdown can far exceed the 90s default; SIGKILL here +# risks a slow replay or a reindex +TimeoutStopSec=1800 + PrivateTmp=true ProtectSystem=full NoNewPrivileges=true -- cgit v1.2.3