bitcoind – bitcoin-cli cannot connect with server

0
7
bitcoind – bitcoin-cli cannot connect with server


I do know this query is nearly decade outdated however I simply had an identical drawback on two fashionable machines with Bitcoin Core 28.1.0 underneath Ubuntu Server 22.04.1 (x86) and Ubuntu 22.04.5 (Arm) and wasted like two hours enjoying Linux admin whereas the answer was (at the least for me) actually easy. So let me depart this reply right here for others.

I used to be beginning Bitcoin Core as a daemon on boot with crontab entry like this:

@reboot bitcoind -daemon

The daemon gave the impression to be working, it was synchronising blocks however upon executing instructions regionally e.g.

bitcoin-cli getblockcount

I used to be simply getting errors:

error: timeout on transient error: Couldn't connect with the server 127.0.0.1:8332. (...)

and in debug.log I used to be discovering:

Binding RPC on handle 127.0.0.1 port 8123 failed.

What mounted this for me was merely delaying daemon begin for a couple of seconds, by enhancing my crontab to seem like this:

@reboot sleep 10 && bitcoind -daemon

No adjustments to bitcoin.conf, settings.json or a firewall required. Bear in mind that you could be must play with the sleep worth. I had this difficulty on two machines, on certainly one of them 5 seconds delay was sufficient, on one other one I needed to change it to 10.

I’m not certain what’s the precise underlying difficulty so if a customer to this query is aware of – be at liberty to remark and share.

LEAVE A REPLY

Please enter your comment!
Please enter your name here