Author

Topic: RPC port 8332 not accessible after reboot (Read 183 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
April 07, 2022, 07:19:51 AM
#6
I basically use the the "/bitcoin/core/bitcoin/contrib/init/bitcoind.service" which I just slightly edit...

Do you mean this file https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service ?
newbie
Activity: 10
Merit: 18
Yes, correct Smiley
newbie
Activity: 10
Merit: 18
I basically use the the "/bitcoin/core/bitcoin/contrib/init/bitcoind.service" which I just slightly edit...

I was able to solve the problem by adding the following to the bitcoin.conf file:

Code:
rpcbind=0.0.0.0
rpcport=8332
rpcallowip=192.168.230.0/255.255.255.0
hero member
Activity: 924
Merit: 5943
not your keys, not your coins!
Any idea what will solve the problem?

Can you share your bitcoind unit file (bitcoind.service file)? I only could think it's caused when bitcoind started. But if you don't mind ugly workaround, edit your crontab to restart the service shortly after boot.

Code:
@reboot sleep 30 && systemctl restart bitcoind
That's not very clean though. I would first ask OP to send their systemd service file and to have a look at the debug.log of Bitcoin Core; usually there's something useful in there.

I do suspect that it's something like missing a After=network.target or something like this.
For reference, I use:
Code:
[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf

# Make sure the config directory is readable by the service user
PermissionsStartOnly=true

# Process management
####################

Type=forking
Restart=on-failure

# Directory creation and permissions
####################################

# Run as bitcoin:bitcoin
User=bitcoin
Group=users

# Hardening measures
####################

# Provide a private /tmp and /var/tmp.
PrivateTmp=true

# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full

# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true

# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true

# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target
newbie
Activity: 10
Merit: 18
I have compiled and installed Bitcoin Core for the first time on Debian 11. Everything is up and running except that RPC port 8332 is not accessible after a reboot.

I get the following error running bitcoin-cli getblockcount:

error: timeout on transient error: Could not connect to the server 127.0.0.1:8332

If I then run systemctl restart bitcoind then everything works fine.

systemctl status bitcoind shows that it is up and running just fine after a reboot.

Look at this after the reboot:

Code:
netstat -nap | grep bitcoin | grep LISTEN

tcp 0 0 0.0.0.0:8333 0.0.0.0:* LISTEN 456/bitcoind
tcp 0 0 127.0.0.1:8334 0.0.0.0:* LISTEN 456/bitcoind
tcp6 0 0 ::1:8332 :::* LISTEN 456/bitcoind
tcp6 0 0 :::8333 :::* LISTEN 456/bitcoind

And then after systemctl restart bitcoind:

Code:
tcp 0 0 127.0.0.1:8332 0.0.0.0:* LISTEN 532/bitcoind
tcp 0 0 0.0.0.0:8333 0.0.0.0:* LISTEN 532/bitcoind
tcp 0 0 127.0.0.1:8334 0.0.0.0:* LISTEN 532/bitcoind
tcp6 0 0 ::1:8332 :::* LISTEN 532/bitcoind
tcp6 0 0 :::8333 :::* LISTEN 532/bitcoind
For some reason the 8332 port is not opened on reboot...

Any idea what will solve the problem?
Jump to: