1

I've created a bitcoin.service file as found here:

https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service

However i've modified it as i build bitcoin-core from source to the following:

https://gist.github.com/anonymous/7e1bca97739147d698327d7f3a119992

It is installed to:

/lib/systemd/system

As apparently in this version of Ubuntu it must be there

It runs when i run this command:

bitcoind -daemon -pid=/home/chris/.bitcoin/bitcoind.pid -
conf=/home/chris/.bitcoin/bitcoin.conf -datadir=/home/chris/.bitcoin/ 
-disablewallet

However trying to run:

systemctl start bitcoind

Gives this error

bitcoind.service - Bitcoin's distributed currency daemon
   Loaded: loaded (/lib/systemd/system/bitcoind.service; enabled; 
vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2017-10-15 17:27:38 
BST; 2s ago
  Process: 4180 ExecStart=/home/chris/.bitcoin/bitcoind -daemon -
pid=/home/chris/.bitcoin/bitcoind.pid -
conf=/home/chris/.bitcoin/bitcoin.conf -datadir=/home/chris/.bitcoin/ 
-disablewallet (code=exited, status=203

Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Unit 
entered failed state.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Failed 
with result 'exit-code'.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Service 
hold-off time over, scheduling restart.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: Stopped Bitcoin's 
distributed currency daemon.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Start 
request repeated too quickly.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: Failed to start Bitcoin's 
distributed currency daemon.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Unit 
entered failed state.
Oct 15 17:27:38 chris-GE60-2PL systemd[1]: bitcoind.service: Failed 
with result 'exit-code'.

Does anyone know what i'm doing wrong here ?

1
  • Usually, -conf={file} not {path}/{file}
    – Willtech
    Feb 27, 2018 at 8:21

2 Answers 2

1

It runs when i run this command:

bitcoind -daemon -pid=/home/chris/.bitcoin/bitcoind.pid -
conf=/home/chris/.bitcoin/bitcoin.conf -datadir=/home/chris/.bitcoin/ 
-disablewallet

When you run that command, where are you in your server? At the base level of your home folder? Your service file ExecStart= must point to the same location, and currently it's looking for bitcoind in /home/chris/.bitcoin/. Are you sure bitcoind is inside the directory .bitcoin in your home folder?

As a side note, that is a odd location for the binary. Consider placing bitcoind and bitcoin-cli in /usr/local/bin/. That way you can run it from anywhere in your server without specifying a path. But for the service file, you'd then should specify the full path, such as

ExecStart=/usr/local/bin/bitcoind -daemon -pid=/home/chris/.bitcoin/bitcoind.pid \
-conf=/home/chris/.bitcoin/bitcoin.conf -datadir=/home/chris/.bitcoin/ -disablewallet

You should also consider changing the location of the PID file and you can also omit -datadir=/home/chris/.bitcoin/, as bitcoind will by default look for the data dir in that location, since the service is being started by the user 'chris'. These are suggestions taken from the official Bitcoin template you linked in your post.

Don't forget to sudo systemctl daemon-reload after you make changes to systemd service files, before sudo systemctl restart <service-name.service> for example.

1
  • sudo systemdctl daemon reload should be sudo systemdctl daemon-reload note the dash.
    – whitebeard
    Jun 13, 2019 at 7:23
0

I happen to run across this, and I don't know if you ever got this working. Try using the correct executable in the bitcoind.service file for the ExecStart line (11 of your gist). My bitcoind is installed in /usr/bin/bitcoind.

I also commented on your gist above with an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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