<p>The issue is that you have a <code>settings.json</code> file with <code>&quot;server&quot;: false</code>, disabling the RPC server. This file takes precedence over <code>bitcoin.conf</code>.</p>

CC BY-SA 4.0
2023-12-15T19:03:28.087Z
2023-12-15T19:03:28.087Z
Pieter Wuille
<p>I have: server=1 daemon=1 in the config, bitcoind running as user as well as bitcoin-cli, no special config or anything - when I try to use bitcoin-cli it wont connect to 127.0.0.1:8332, bitcoind is synced to tip and running fine, what's wrong? Do I need to configure something regarding firewalls manually?</p>
<p>Full config:</p>
<pre><code>proxy=127.0.0.1:9050
bind=127.0.0.1
listen=1
listenonion=1
server=1
daemon=1
</code></pre>
<p><code>./bitcoin-cli getblockchain</code></p>
<p>produces</p>
<p><code>error: timeout on transient error: Could not connect to the server 127.0.0.1:8332 Make sure the bitcoind server is running and that you are connecting to the correct rpc port.</code></p>

CC BY-SA 4.0
2023-12-15T18:05:26.883Z
Please update your question with the exact commands you are running, and the output you see.
Pieter Wuille
CC BY-SA 4.0
2023-12-15T18:13:01.243Z
Done sorry about that
BobbyJones
CC BY-SA 4.0
2023-12-15T18:13:35.557Z
How do you start `bitcoind`, and does anything appear in the debug.log?
Pieter Wuille
CC BY-SA 4.0
2023-12-15T18:18:53.743Z
I start bitcoind with a systemd service, the config for that I have is here https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service but obviously to replace basic info such as user/group, datadir, etc. The daemon itself is functional and synced to the tip, sitting int he debug.log I can see it's working as intended.

I just cannot connect to the daemon with bitcoin-cli for some reason
BobbyJones
CC BY-SA 4.0
2023-12-15T18:25:42.630Z
If it's relevant I'm using debian12, it was just a fresh install out of the box, I don't have anything custom on the machine. The only thing different would possibly be my exfat externalhdd that is mounted as user:user to match it running with the running user for bitcoind
BobbyJones
CC BY-SA 4.0
2023-12-15T18:30:16.843Z
What port(s) does `netstat -ltnp` (run as the bitcoin service user, or as root) show `bitcoind` to be running on?
Pieter Wuille
CC BY-SA 4.0
2023-12-15T18:37:17.583Z
It wasn't installed on debian12 ootb but I installed net-tools and `netstat -ltnp` shows that it's listening on 8333/8334 for tcp connections, I tried `bitcoin-cli -rpcport=8333 getblockchaininfo` but that doesn't seem to work either

`(The new error with the above command is: error: timeout on transient error: Could not connect to the server 127.0.0.1:8333 (error code 1 - "EOF reached") Make sure the bitcoind server is running and that you are connecting to the correct rpc port.)`
BobbyJones
CC BY-SA 4.0
2023-12-15T18:39:45.143Z
Clearly `bitcoind` is not listening on the RPC port. Is there any indication in `debug.log`? Normally you'd expect a line like "Binding RPC on address 127.0.0.1 port 8332". Is there anything of the sort? Also feel free to just update your post with whatever you see in debug.log. 8333 and 8334 are the P2P ports; they won't work for RPC.
Pieter Wuille
CC BY-SA 4.0
2023-12-15T18:46:24.347Z
I do not see anything regarding binding RPC on address 127.0.0.1:8332. I have included the debug log here which you can view: https://litter.catbox.moe/2cdfas.txt
BobbyJones
CC BY-SA 4.0
2023-12-15T18:52:50.010Z
"Setting file arg: server = false", you have the RPC server disabled (in settings.json, I suspect).
Pieter Wuille
CC BY-SA 4.0
2023-12-15T18:59:09.457Z
Thanks you so much now it works as long as I provide the -datadir argument with bitcoin-cli. But I'm confused, I thought bitcoin.conf takes precedence over everything, so shouldn't server=1 force it to listen? I'm not really sure what settings.json is for or why there's a separate setting file, would you kindly elaborate? You the man though :D
BobbyJones
CC BY-SA 4.0
2023-12-15T19:01:02.197Z
settings.json takes precedence over bitcoin.conf. The difference is just that settings.json is modifiable by Bitcoin Core itself (e.g. the GUI).
Pieter Wuille
CC BY-SA 4.0
2023-12-15T19:04:27.320Z
Aha good to know thanks a lot man, I feel silly
BobbyJones
<bitcoin-core><bitcoin-cli>
Bitcoin-cli does not connect to bitcoind and cant execute commands no matter what
BobbyJones
# Bitcoin-cli does not connect to bitcoind and cant execute commands no matter what

(Asked by: username_0 on 2023-12-15)

I have: server=1 daemon=1 in the config, bitcoind running as user as well as bitcoin-cli, no special config or anything - when I try to use bitcoin-cli it wont connect to 127.0.0.1:8332, bitcoind is synced to tip and running fine, what's wrong? Do I need to configure something regarding firewalls manually?

Full config:

```
proxy=127.0.0.1:9050
bind=127.0.0.1
listen=1
listenonion=1
server=1
daemon=1

```

`./bitcoin-cli getblockchain`

produces

`error: timeout on transient error: Could not connect to the server 127.0.0.1:8332 Make sure the bitcoind server is running and that you are connecting to the correct rpc port.`

**Tags:** bitcoin-core, bitcoin-cli

> **Comments:**
> **username_1**: Please update your question with the exact commands you are running, and the output you see.  
> **username_0**: Done sorry about that  
> **username_1**: How do you start `bitcoind`, and does anything appear in the debug.log?  
> **username_0**: I start bitcoind with a systemd service, the config for that I have is here https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service but obviously to replace basic info such as user/group, datadir, etc. The daemon itself is functional and synced to the tip, sitting int he debug.log I can see it's working as intended.  I just cannot connect to the daemon with bitcoin-cli for some reason  
> **username_0**: If it's relevant I'm using debian12, it was just a fresh install out of the box, I don't have anything custom on the machine. The only thing different would possibly be my exfat externalhdd that is mounted as user:user to match it running with the running user for bitcoind  
> **username_1**: What port(s) does `netstat -ltnp` (run as the bitcoin service user, or as root) show `bitcoind` to be running on?  
> **username_0**: It wasn't installed on debian12 ootb but I installed net-tools and `netstat -ltnp` shows that it's listening on 8333/8334 for tcp connections, I tried `bitcoin-cli -rpcport=8333 getblockchaininfo` but that doesn't seem to work either  `(The new error with the above command is: error: timeout on transient error: Could not connect to the server 127.0.0.1:8333 (error code 1 - "EOF reached") Make sure the bitcoind server is running and that you are connecting to the correct rpc port.)`  
> **username_1**: Clearly `bitcoind` is not listening on the RPC port. Is there any indication in `debug.log`? Normally you'd expect a line like "Binding RPC on address 127.0.0.1 port 8332". Is there anything of the sort? Also feel free to just update your post with whatever you see in debug.log. 8333 and 8334 are the P2P ports; they won't work for RPC.  
> **username_0**: I do not see anything regarding binding RPC on address 127.0.0.1:8332. I have included the debug log here which you can view: https://litter.catbox.moe/2cdfas.txt  
> **username_1**: "Setting file arg: server = false", you have the RPC server disabled (in settings.json, I suspect).  
> **username_0**: Thanks you so much now it works as long as I provide the -datadir argument with bitcoin-cli. But I'm confused, I thought bitcoin.conf takes precedence over everything, so shouldn't server=1 force it to listen? I'm not really sure what settings.json is for or why there's a separate setting file, would you kindly elaborate? You the man though :D  
> **username_1**: settings.json takes precedence over bitcoin.conf. The difference is just that settings.json is modifiable by Bitcoin Core itself (e.g. the GUI).  
> **username_0**: Aha good to know thanks a lot man, I feel silly  

---

## 1 answers

### Answer by username_1 on 2023-12-15. Score: 0 | Accepted answer

The issue is that you have a `settings.json` file with `"server": false`, disabling the RPC server. This file takes precedence over `bitcoin.conf`.


---

