Improve openrc init scripts

bitcoin/bitcoin: PR #36941

3 minor findings

Findings

Link

[minor] · BITCOIN_USER and NICELEVEL compatibility fallbacks disappear

BITCOIN_USER-only and NICELEVEL-only OpenRC configurations now select the default user and niceness settings instead; no in-tree configuration using these legacy names was found.

Location: contrib/init/bitcoind.openrc:27 (head).

Details and suggested fix

With BITCOIND_USER unset, base selected BITCOIN_USER, but the new command_user expression selects bitcoin and passes that owner to all three checkpath -o calls. Similarly, with BITCOIND_NICE unset, the script exports SSD_NICELEVEL=0 rather than the configured NICELEVEL. This silently discards previously supported settings while the BITCOIN_OPTS compatibility fallback remains. The exact effect on existing path ownership was not verified. Restore ${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}} in command_user and ${BITCOIND_NICE:-${NICELEVEL:-0}} in SSD_NICELEVEL to preserve compatibility and modern-name precedence.


Link

[minor] · OpenRC ignores the BITCOIND_BIN executable-path override

BITCOIND_BIN overrides now select /usr/bin/bitcoind instead of the configured executable, potentially preventing startup or launching another installed version; no in-tree OpenRC configuration using a non-default path was found.

Location: contrib/init/bitcoind.openrc:21 (head).

Details and suggested fix

The old template advertised BITCOIND_BIN, and the script used it for command. Hardcoding command=/usr/bin/bitcoind silently ignores an existing setting such as /usr/local/bin/bitcoind. If the hardcoded path is absent, startup cannot use the configured executable; if another version exists there, the script selects it instead. Shipping a single binary does not fix its installation directory, and doc/init.md explicitly allows Linux path adjustments. Keep command="${BITCOIND_BIN:-/usr/bin/bitcoind}" and the template entry to preserve this configuration option without changing the default.


Link

[minor] · Existing BITCOIND_SIGTERM_TIMEOUT settings are silently ignored

Existing OpenRC configurations that retain only BITCOIND_SIGTERM_TIMEOUT silently lose their custom stop schedule because the script no longer maps it to retry.

Location: contrib/init/bitcoind.openrcconf:33 (base).

Details and suggested fix

The old template documented both numeric timeouts and signal/timeout schedules, and the script copied the configured value into retry. Head never reads the old name or warns about it. Correcting the default assignment alone would still replace a custom value with 600 when native retry is unset. Preserve the old setting for a transition release with retry="${retry:-${BITCOIND_SIGTERM_TIMEOUT:-600}}", which gives an explicit native retry value precedence. Whether downstream package upgrades migrate existing configurations is not established here.


Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Ten minutes was a pragmatic finite default, not a demonstrated upper bound on shutdown duration. The discussion weighed disabling the timeout against the risk that a wedged shutdown would never recover automatically. One participant reported an almost nine-minute clean shutdown with a 15 GB database cache; the eventual compromise was a "fairly long" ten-minute timeout, which the author accepted as a reasonable default.

BITCOIND_SIGTERM_TIMEOUT=600 embodies a balance between allowing normal flushing and bounding shutdown delays. The history does not support treating 600 seconds as a guarantee that every healthy node will finish, nor treating an unlimited wait as the established requirement.

Source 1 · Source 2 · Source 3 · Source 4