Bitcoin Forum
May 05, 2024, 08:16:04 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with testnet node  (Read 110 times)
DireWolfM14 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2170
Merit: 4238


Join the world-leading crypto sportsbook NOW!


View Profile WWW
December 12, 2021, 07:19:21 PM
Last edit: December 12, 2021, 08:45:09 PM by DireWolfM14
Merited by hugeblack (4), RickDeckard (2), ABCbits (1), Pmalek (1)
 #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=<rpcuser>:<rpcpassword>
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.  

  ▄▄███████▄███████▄▄▄
 █████████████
▀▀▀▀▀▀████▄▄
███████████████
       ▀▀███▄
███████████████
          ▀███
 █████████████
             ███
███████████▀▀               ███
███                         ███
███                         ███
 ███                       ███
  ███▄                   ▄███
   ▀███▄▄             ▄▄███▀
     ▀▀████▄▄▄▄▄▄▄▄▄████▀▀
         ▀▀▀███████▀▀▀
░░░████▄▄▄▄
░▄▄░
▄▄███████▄▀█████▄▄
██▄████▌▐█▌█████▄██
████▀▄▄▄▌███░▄▄▄▀████
██████▄▄▄█▄▄▄██████
█░███████░▐█▌░███████░█
▀▀██▀░██░▐█▌░██░▀██▀▀
▄▄▄░█▀░█░██░▐█▌░██░█░▀█░▄▄▄
██▀░░░░▀██░▐█▌░██▀░░░░▀██
▀██
█████▄███▀▀██▀▀███▄███████▀
▀███████████████████████▀
▀▀▀▀███████████▀▀▀▀
▄▄██████▄▄
▀█▀
█  █▀█▀
  ▄█  ██  █▄  ▄
█ ▄█ █▀█▄▄█▀█ █▄ █
▀▄█ █ ███▄▄▄▄███ █ █▄▀
▀▀ █    ▄▄▄▄    █ ▀▀
   ██████   █
█     ▀▀     █
▀▄▀▄▀▄▀▄▀▄▀▄
▄ ██████▀▀██████ ▄
▄████████ ██ ████████▄
▀▀███████▄▄███████▀▀
▀▀▀████████▀▀▀
█████████████LEADING CRYPTO SPORTSBOOK & CASINO█████████████
MULTI
CURRENCY
1500+
CASINO GAMES
CRYPTO EXCLUSIVE
CLUBHOUSE
FAST & SECURE
PAYMENTS
.
..PLAY NOW!..
1714940164
Hero Member
*
Offline Offline

Posts: 1714940164

View Profile Personal Message (Offline)

Ignore
1714940164
Reply with quote  #2

1714940164
Report to moderator
1714940164
Hero Member
*
Offline Offline

Posts: 1714940164

View Profile Personal Message (Offline)

Ignore
1714940164
Reply with quote  #2

1714940164
Report to moderator
1714940164
Hero Member
*
Offline Offline

Posts: 1714940164

View Profile Personal Message (Offline)

Ignore
1714940164
Reply with quote  #2

1714940164
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
OddyseyGames
Jr. Member
*
Offline Offline

Activity: 39
Merit: 9


View Profile
December 12, 2021, 11: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=<rpcuser>:<rpcpassword>

# Options only for regtest
[regtest]
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 15, 2021, 10: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?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!