Skip to content

bitcoind and bitcoin-cli does not supports symbolic link anymore #24257

@nymkappa

Description

@nymkappa

I just pulled latest master at 3ace3a1 and I cannot run bitcoind or bitcoin-cli without providing a full path for data directory using -datadir option. It was working fine couple of days ago (while running 807169e). I suspect it may be related to latest switch to the standard std::filesystem library #20744

Expected behavior

I use a symbolic link to point my /home/me/.bitcoin to an external hard drive. When running bitcoind from command line, or executing bitcoin-cli commands, without using the -datadir option, it should not terminate or crash unexpectedly. Those commands should be able to follow the symbolic link and be able to read/write into the final folder.

Actual behavior

bitcoind and bitcoin-cli are not able to follow the symbolic link. bitcoin-qt runs fine, even when running it from command line. See below commands examples.

# Create a symbolic link
$~/btc-things/bitcoin$ ln -s /media/DATA/Bitcoin /home/me/.bitcoin

# Try to run bitcoind - Crashes
$~/btc-things/bitcoin$ ./bitcoind 


************************
EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE       
filesystem error: cannot create directories: Not a directory [/home/me/.bitcoin]       
bitcoin in AppInit()       

bitcoind: chainparamsbase.cpp:35: const CBaseChainParams& BaseParams(): Assertion `globalChainBaseParams' failed.
Aborted (core dumped)

# Run bitcoin-qt, it works fine, the node runs
$~/btc-things/bitcoin$ ./bitcoin-qt 
qt5ct: using qt5ct plugin

# Try to run a bitcoin-cli command to interact with the running node, does not work
$~/btc-things/bitcoin$ ./bitcoin-cli getblockhash 501726


************************
EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE       
filesystem error: cannot create directories: Not a directory [/home/me/.bitcoin]       
bitcoin in AppInitRPC()       

# Try the same previous command but give an absolute path for -datadir, works fine
$~/btc-things/bitcoin$ ./bitcoin-cli -datadir=/media/DATA/Bitcoin getblockhash 501726
0000000000000000004b27f9ee7ba33d6f048f684aaeb0eea4befd80f1701126

To reproduce

Steps are indicated previously.

System information

Running Bitcoin Core version v22.99.0-3ace3a17c9bc. Self compiled from master branch.

I'm using Linux Mint with the following kernel Linux 5.4.0-96-generic x86_64.
I'm using an additional hard drive to store the full blockchain (SSD).

I had no prior issues before pulling latest changes. I was previously running at 807169e

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions