The bitcoind service silently loads the default configuration if the .conf file is specified but not readable #22612

issue voidburn opened this issue on August 2, 2021
  1. voidburn commented at 9:09 PM on August 2, 2021: none

    [ Setup ] Assuming a working bitcoin core setup is present and all paths (data, conf, run) are properly setup as required by the service unit provided here (https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service).

    [ Issue ] If the following statements are true:

    • the folder /etc/bitcoin has the permissions 0710 and has the owner/group root:bitcoin
    • the config file has permissions or ownership that make it not accessible to the user running the daemon, for example: /etc/bitcoin/bitcoin.conf has the permissions 0640 and has the owner/group root:root.

    Starting the service will result in an instance using plain defaults without a single warning about the specified config file being inaccessible to it.

    [ Expected behavior ] Startup failure with a clear error message that the provided config file is not readable. I can't think of a situation in which a config file is specified explicitly (in the startup options, as per service unit linked above), but inaccessible, where the fail condition should be to keep booting using defaults instead.

    [ Actual behavior ] The service starts with no warning whatsoever, nor a message logged about it (see debug.log below)

    [ Reliability ] 100% reproducible

    [ Core version ] 0.21.1

    [ OS ] Ubuntu server 20.04.1

    [ Bootstrap Log ]

    2021-08-02T20:54:00Z Assuming ancestors of block 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72 have valid signatures.
    2021-08-02T20:54:00Z Setting nMinimumChainWork=00000000000000000000000000000000000000001533efd8d716a517fe2c5008
    2021-08-02T20:54:00Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2021-08-02T20:54:00Z Using RdSeed as additional entropy source
    2021-08-02T20:54:00Z Using RdRand as an additional entropy source
    2021-08-02T20:54:00Z Default data directory /var/lib/bitcoind/.bitcoin
    2021-08-02T20:54:00Z Using data directory /var/lib/bitcoind
    2021-08-02T20:54:00Z Config file: /etc/bitcoin/bitcoind.conf
    2021-08-02T20:54:00Z Command-line arg: conf="/etc/bitcoin/bitcoind.conf"
    2021-08-02T20:54:00Z Command-line arg: daemon=""
    2021-08-02T20:54:00Z Command-line arg: datadir="/var/lib/bitcoind"
    2021-08-02T20:54:00Z Command-line arg: pid="/run/bitcoind/bitcoind.pid"
    2021-08-02T20:54:00Z Using at most 125 automatic connections (1024 file descriptors available)
    2021-08-02T20:54:00Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
    2021-08-02T20:54:01Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
    2021-08-02T20:54:01Z Script verification uses 7 additional threads
    2021-08-02T20:54:01Z scheduler thread start
    2021-08-02T20:54:01Z HTTP: creating work queue of depth 16
    2021-08-02T20:54:01Z Using random cookie authentication.
    2021-08-02T20:54:01Z Generated RPC authentication cookie /var/lib/bitcoind/.cookie
    2021-08-02T20:54:01Z HTTP: starting 4 worker threads
    2021-08-02T20:54:01Z Using wallet directory /var/lib/bitcoind
    2021-08-02T20:54:01Z init message: Verifying wallet(s)...
    2021-08-02T20:54:01Z init message: Loading banlist...
    2021-08-02T20:54:01Z SetNetworkActive: true
    2021-08-02T20:54:01Z Using /16 prefix for IP bucketing
    2021-08-02T20:54:01Z Cache configuration:
    2021-08-02T20:54:01Z * Using 2.0 MiB for block index database
    2021-08-02T20:54:01Z * Using 8.0 MiB for chain state database
    2021-08-02T20:54:01Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
    2021-08-02T20:54:01Z init message: Loading block index...
    2021-08-02T20:54:01Z Switching active chainstate to Chainstate [ibd] @ height -1 (null)
    2021-08-02T20:54:01Z Opening LevelDB in /var/lib/bitcoind/blocks/index
    2021-08-02T20:54:01Z Opened LevelDB successfully
    2021-08-02T20:54:01Z Using obfuscation key for /var/lib/bitcoind/blocks/index: 0000000000000000
    2021-08-02T20:54:04Z LoadBlockIndexDB: last block file = 2673
    2021-08-02T20:54:04Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=95, size=126973024, heights=693816...693910, time=2021-08-02...2021-08-02)
    2021-08-02T20:54:04Z Checking all blk files are present...
    2021-08-02T20:54:04Z Opening LevelDB in /var/lib/bitcoind/chainstate
    2021-08-02T20:54:04Z Opened LevelDB successfully
    2021-08-02T20:54:04Z Using obfuscation key for /var/lib/bitcoind/chainstate: 552509bc3d6a34b5
    2021-08-02T20:54:04Z Loaded best chain: hashBestChain=0000000000000000000275f0f28b4c0cc7a7552f78669b2f6ba2b3d9809d065b height=693910 date=2021-08-02T20:24:59Z progress=0.999991
    2021-08-02T20:54:04Z init message: Rewinding blocks...
    2021-08-02T20:54:04Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
    2021-08-02T20:54:04Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
    2021-08-02T20:54:04Z init message: Verifying blocks...
    2021-08-02T20:54:04Z Verifying last 6 blocks at level 3
    2021-08-02T20:54:04Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
    2021-08-02T20:54:05Z No coin database inconsistencies in last 6 blocks (9363 transactions)
    2021-08-02T20:54:05Z  block index            4042ms
    2021-08-02T20:54:05Z block tree size = 693913
    2021-08-02T20:54:05Z nBestHeight = 693910
    2021-08-02T20:54:05Z loadblk thread start
    2021-08-02T20:54:05Z Bound to [::]:8333
    2021-08-02T20:54:05Z torcontrol thread start
    2021-08-02T20:54:05Z Bound to 0.0.0.0:8333
    2021-08-02T20:54:05Z Bound to 127.0.0.1:8334
    2021-08-02T20:54:05Z init message: Loading P2P addresses...
    2021-08-02T20:54:05Z Leaving InitialBlockDownload (latching to false)
    2021-08-02T20:54:05Z Loaded 65864 addresses from peers.dat  174ms
    2021-08-02T20:54:05Z Loaded 2 addresses from "anchors.dat"
    2021-08-02T20:54:05Z 2 block-relay-only anchors will be tried for connections.
    2021-08-02T20:54:05Z init message: Starting network threads...
    2021-08-02T20:54:05Z net thread start
    2021-08-02T20:54:05Z addcon thread start
    2021-08-02T20:54:05Z dnsseed thread start
    2021-08-02T20:54:05Z Waiting 300 seconds before querying DNS seeds.
    2021-08-02T20:54:05Z init message: Done loading
    2021-08-02T20:54:05Z opencon thread start
    2021-08-02T20:54:05Z msghand thread start
    2021-08-02T20:54:05Z New outbound peer connected: version: 70016, blocks=693910, peer=0 (block-relay)
    2021-08-02T20:54:07Z New outbound peer connected: version: 70015, blocks=693910, peer=1 (block-relay)
    2021-08-02T20:54:07Z Imported mempool transactions from disk: 4395 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
    2021-08-02T20:54:07Z loadblk thread exit
    2021-08-02T20:54:07Z New outbound peer connected: version: 70015, blocks=693910, peer=2 (full-relay)
    2021-08-02T20:54:13Z New outbound peer connected: version: 70016, blocks=693910, peer=3 (full-relay)
    2021-08-02T20:54:13Z New outbound peer connected: version: 70016, blocks=693910, peer=4 (full-relay)
    2021-08-02T20:54:16Z P2P peers available. Skipped DNS seeding.
    2021-08-02T20:54:16Z dnsseed thread exit
    2021-08-02T20:54:20Z New outbound peer connected: version: 70015, blocks=693910, peer=5 (full-relay)```
    
  2. MarcoFalke closed this on Aug 23, 2021

  3. sidhujag referenced this in commit 8b35ac35c4 on Aug 23, 2021
  4. DrahtBot locked this on Aug 23, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me