0

Hey I keep getting this error everytime I run sudo systemctl enable --now bitcoind

Job for bitcoind.service failed because the control process exited with error code.
See "systemctl status bitcoind.service" and "journalctl -xe" for details.

When I input sudo journalctl -xe --unit bitcoind I get this:

bitcoind.service - Bitcoin daemon
     Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor pres>
     Active: failed (Result: exit-code) since Wed 2020-12-30 15:12:05 UTC; 23s >
    Process: 2411 ExecStartPre=/bin/chgrp admin /etc/bitcoin (code=exited, stat>

Here is how my bitcoind.service looks. I changed the user and group from bitcoin to admin.

[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/usr/bin/bitcoind -daemon \
                            -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 admin /etc/bitcoin

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

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

# Run as admin:admin
User=admin
Group=admin

# /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

# Deny access to /home, /root and /run/user
ProtectHome=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

Here are the steps I made before:

~$ cd src
~/src$ git clone --depth 1 --branch v0.20.1 https://github.com/bitcoin/bitcoin.git
~/src$ cd bitcoin
~/src/bitcoin$ ./contrib/install_db4.sh `pwd`
~/src/bitcoin$ ./autogen.sh
~/src/bitcoin$ export BDB_PREFIX='/home/ubuntu/src/bitcoin/db4'
~/src/bitcoin$ ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
~/src/bitcoin$ make
~/src/bitcoin$ sudo make install 
~/src/bitcoin$ bitcoind -version
vi bitcoin.conf
server=1                              
rpcbind=127.0.0.1                     
whitelist=127.0.0.1                   
rpcallowip=127.0.0.1/32               
zmqpubrawblock=tcp://127.0.0.1:28332  
zmqpubrawtx=tcp://127.0.0.1:28333 

~$ sudo mkdir -p /etc/bitcoin
~$ sudo cp bitcoin.conf /etc/bitcoin
~$ sudo chmod 644 /etc/bitcoin/bitcoin.conf

Utimately I got

ubuntu systemd[1]: Failed to start Bitcoin daemon.

1

1 Answer 1

0

if you installed Bitcoin core using a PPA, it means your script is looking for bitcoind in the wrong place.

To confirm where your bitcoind was installed, use whereis bitcoind

This will likely return /usr/local/bin/bitcoind, now your script is looking for it in /usr/bin/bitcoind so you can either copy it into that directory

sudo cp /usr/local/bin/bitcoind /usr/bin/bitcoind

or change your script to look for it in /usr/local/bin/bitcoind

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.