Author

Topic: Help with testnet node (Read 133 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
December 15, 2021, 05:47:44 AM
#3
Quote
Code:
# Make sure the config directory is readable by the service user
PermissionsStartOnly=true
ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin

I think this is what's causing the problem assuming that information about bitcoind's abrupt exit is not inside the debug.log file in /var/lib/bitcoin. You are most likely starting the service under a root shell, but maybe systems is dropping privileges first and then trying to run the chgrp command, which fails due to a permissions error.

Why don't you change the group name of the folder manually?
jr. member
Activity: 39
Merit: 9
December 12, 2021, 06:10:51 PM
#2
Quote
And that resulted in this error:
Error: Config setting for -rpcbind only applied on test network when in [test] section.

I fixed it by adding rpcbind=127.0.0.1 to the [test] section. 

Try with this config. I just moved the RPC parameters to the test section.

Code:
coin=testnet
testnet=1
txindex=1
dbcache=1024
listen=1
onion=127.0.0.1:9050
discover=1
proxyrandomize=1
server=1
addresstype=bech32
changetype=bech32

# Options only for mainnet
[main]

# Options only for testnet
[test]
rpcbind=127.0.0.1
rpcport=18332
rpcauth=:

# Options only for regtest
[regtest]
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
December 12, 2021, 02:19:21 PM
#1
I'm trying to set up a test-net node that closely resembles my main-net node, but I'm having trouble getting it started with systemctl.  I assume my configuration files are the root cause.  Journalctl isn't giving me much information: bitcoind.service: Failed with result 'exit-code'.  The service is supposed to be run by service user "bitcoin," and I made sure the configuration and data directoreis, and the files within are owned by that user.

My bitcoind.service file:

Code:
[Unit]
Description=Bitcoin Testnet
After=network.target

[Service]
ExecStart=/usr/bin/bitcoind -testnet \
                            -pid=/run/bitcoind/bitcoind.pid \
                            -conf=/etc/bitcoin/bitcoin.conf \
                            -datadir=/var/lib/bitcoind

# Make sure the config directory is readable by the service user
PermissionsStartOnly=true
ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin

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

Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure
TimeoutStopSec=600

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

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

# /run/bitcoind
RuntimeDirectory=bitcoind
RuntimeDirectoryMode=0710

# /etc/bitcoin
ConfigurationDirectory=bitcoin
ConfigurationDirectoryMode=0710

# /var/lib/bitcoind
StateDirectory=bitcoind
StateDirectoryMode=0710

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

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

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

# Deny access to /home, /root and /run/user
ProtectHome=true

# 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


My bitcoin.config file:

Code:
coin=testnet
testnet=1
txindex=1
dbcache=1024
listen=1
onion=127.0.0.1:9050
discover=1
proxyrandomize=1
server=1
rpcbind=127.0.0.1
rpcport=18332
rpcauth=:
addresstype=bech32
changetype=bech32

# Options only for mainnet
[main]

# Options only for testnet
[test]
rpcport=18332

# Options only for regtest
[regtest]


EDIT:

I figured it out by trying to run bitcoind from the command line using the same settings as systemctl's bitcoind.service file:
Code:
sudo -H -u bitcoin bash -c 'bitcoind -testnet -pid=/run/bitcoind/bitcoind.pid -conf=/etc/bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind'

And that resulted in this error:
Error: Config setting for -rpcbind only applied on test network when in [test] section.

I fixed it by adding rpcbind=127.0.0.1 to the [test] section.  
Jump to: