<p>I have bitcoind 0.13.1 running on a Raspberry Pi. I can see it on the bitcoin network using bitnodes.21.co but I can't connect to it locally with bitcoin-cli.</p>

<p>My bitcoin.conf is:</p>

<pre><code>rpcuser=xxx
rpcpassword=xxx
listen=1
server=1
dbcache=50
daemon=1
testnet=0
maxuploadtarget=200
</code></pre>

<p>I tried: </p>

<p><code>curl --user xxx --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' 127.0.0.1:8332</code></p>

<p>and I got:</p>

<p><code>curl: (7) Failed to connect to 127.0.0.1 port 8332: Connection refused</code></p>

<p>Netstat:</p>

<p><code>sudo netstat -tulpn | grep bitcoin</code></p>

<p>gives:</p>

<pre><code>tcp        0      0 0.0.0.0:8333            0.0.0.0:*               LISTEN      620/bitcoind    
tcp6       0      0 ::1:8332                :::*                    LISTEN      620/bitcoind    
tcp6       0      0 :::8333                 :::*                    LISTEN      620/bitcoind'
</code></pre>

<p>I had a crash a couple of days ago and had to recover wallet.dat from a backup. After the crash the time on the pi was an hour slow. I had to stop and start <code>ntp</code> to get it correct. I also did an apt-get update and upgrade after the crash. Until the crash this worked fine.</p>

<p>Finally I see that all the files in the dataDir are executable by everyone. The dataDir is on a USB stick that is mounted with:</p>

<p><code>/dev/sda1 /home/pi/bitcoinData vfat uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0</code></p>

<p>I am tempted to start over but would really like to understand why this has stopped working.</p>

CC BY-SA 3.0
2017-03-15T07:43:27.770Z
Have you tried 'curl' with password? `curl -u xxx:xxx <...>`?
Jonas Schnelli
CC BY-SA 3.0
2017-03-15T08:00:17.687Z
I just tried, same error :-(
erols
CC BY-SA 3.0
2017-03-15T12:15:08.190Z
Your rpc request works fine for me. So I changed `bitcoin.conf` and pasted exactly your file. Then I had the same error. But in fact, the only reason I had the error was because `bitcoind` was shutting down immediately (can see this from `debug.log`) due to change in `txindex`.  So I added back `txindex=1` in config file and now your request works fine (with `-u xxx:xxx`). My point is: are you sure `bitcoind`is actually still running when you launch request? (maybe it shuts itself down like it did for me). (I know your `netstat` output seems to indicate `bitcoind` is running  though ...)
Sven Williamson
CC BY-SA 3.0
2017-03-15T12:18:03.693Z
Thanks for trying Sven. bitcoind is definitely running. I can see it in top and ps. I will try txindex=1
erols
CC BY-SA 3.0
2017-03-15T12:25:14.570Z
Ok if you didn't have `txindex=1` before then this will probably mess you up (some time consuming blockchain data processing). Anyway, for what it is worth I am on `v0.14.0` and `x86-64 debian` (not Raspberry). Your config file works as is for me, but maybe the settings `rpcport=8332` and `rpcallowip=0.0.0.0/0` (or something in `127.`) will help.
Sven Williamson
CC BY-SA 3.0
2017-05-09T05:36:57.607Z
Finally I found that my USB stick was defective. Replaced and now working.
erols
<bitcoind><bitcoin-cli>
bitcoin-cli - "error: couldn't connect to server" [solved as per comment]
erols
# bitcoin-cli - "error: couldn't connect to server" [solved as per comment]

(Asked by: username_0 on 2017-03-15)

I have bitcoind 0.13.1 running on a Raspberry Pi. I can see it on the bitcoin network using bitnodes.21.co but I can't connect to it locally with bitcoin-cli.

My bitcoin.conf is:

```
rpcuser=xxx
rpcpassword=xxx
listen=1
server=1
dbcache=50
daemon=1
testnet=0
maxuploadtarget=200

```

I tried:

`curl --user xxx --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' 127.0.0.1:8332`

and I got:

`curl: (7) Failed to connect to 127.0.0.1 port 8332: Connection refused`

Netstat:

`sudo netstat -tulpn | grep bitcoin`

gives:

```
tcp        0      0 0.0.0.0:8333            0.0.0.0:*               LISTEN      620/bitcoind    
tcp6       0      0 ::1:8332                :::*                    LISTEN      620/bitcoind    
tcp6       0      0 :::8333                 :::*                    LISTEN      620/bitcoind'

```

I had a crash a couple of days ago and had to recover wallet.dat from a backup. After the crash the time on the pi was an hour slow. I had to stop and start `ntp` to get it correct. I also did an apt-get update and upgrade after the crash. Until the crash this worked fine.

Finally I see that all the files in the dataDir are executable by everyone. The dataDir is on a USB stick that is mounted with:

`/dev/sda1 /home/pi/bitcoinData vfat uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0`

I am tempted to start over but would really like to understand why this has stopped working.

**Tags:** bitcoind, bitcoin-cli

> **Comments:**
> **username_1**: Have you tried 'curl' with password? `curl -u xxx:xxx <...>`?  
> **username_0**: I just tried, same error :-(  
> **username_2**: Your rpc request works fine for me. So I changed `bitcoin.conf` and pasted exactly your file. Then I had the same error. But in fact, the only reason I had the error was because `bitcoind` was shutting down immediately (can see this from `debug.log`) due to change in `txindex`.  So I added back `txindex=1` in config file and now your request works fine (with `-u xxx:xxx`). My point is: are you sure `bitcoind`is actually still running when you launch request? (maybe it shuts itself down like it did for me). (I know your `netstat` output seems to indicate `bitcoind` is running  though ...)  
> **username_0**: Thanks for trying username_2. bitcoind is definitely running. I can see it in top and ps. I will try txindex=1  
> **username_2**: Ok if you didn't have `txindex=1` before then this will probably mess you up (some time consuming blockchain data processing). Anyway, for what it is worth I am on `v0.14.0` and `x86-64 debian` (not Raspberry). Your config file works as is for me, but maybe the settings `rpcport=8332` and `rpcallowip=0.0.0.0/0` (or something in `127.`) will help.  
> **username_0**: Finally I found that my USB stick was defective. Replaced and now working.  

---

## 0 answers

