Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Unit]
Description=Bitcoin's distributed currency daemon
After=network.target
[Service]
User=chris
Group=chris
Type=forking
PIDFile=/home/chris/.bitcoin/bitcoind.pid
ExecStart=/home/chris/.bitcoin/bitcoind -daemon -pid=/home/chris/.bitcoin/bitcoind.pid \
-conf=/home/chris/.bitcoin/bitcoin.conf -datadir=/home/chris/.bitcoin/ -disablewallet
Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
@AlienResidents

This comment has been minimized.

Copy link

commented Feb 27, 2018

It's most likely your "ExecStart" line. Fix that like to point to the correct bitcoind executable, and it should work for you. I tested this with a "test" user as you can see below.

test@localhost:~$ ps -ef |grep -E '^test.*bitcoind'
test      8342  7594  0 13:56 pts/2    00:00:00 grep --color=auto -E ^test.*bitcoind
test@localhost:~$ bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid -conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet
Bitcoin server starting
test@localhost:~$ ps -ef |grep -E '^test.*bitcoind'
test      8345     1  7 13:56 ?        00:00:00 bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid -conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet
test      8356  7594  0 13:56 pts/2    00:00:00 grep --color=auto -E ^test.*bitcoind
test@localhost:~$ kill -9 8345
test@localhost:~$ ps -ef |grep -E '^test.*bitcoind'
test      8364  7594  0 13:57 pts/2    00:00:00 grep --color=auto -E ^test.*bitcoind
test@localhost:~$ sudo systemctl list-unit-files | grep bitcoind
bitcoind.service                           disabled
test@localhost:~$ sudo systemctl start bitcoind
Job for bitcoind.service failed because the control process exited with error code. See "systemctl status bitcoind.service" and "journalctl -xe" for details.
test@localhost:~$ sudo systemctl status bitcoind.service
● bitcoind.service - Bitcoin's distributed currency daemon
   Loaded: loaded (/lib/systemd/system/bitcoind.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Feb 27 14:03:33 alaska systemd[1]: Stopped Bitcoin's distributed currency daemon.
Feb 27 14:03:33 alaska systemd[1]: Starting Bitcoin's distributed currency daemon...
Feb 27 14:03:33 alaska systemd[1]: bitcoind.service: Control process exited, code=exited status=203
Feb 27 14:03:33 alaska systemd[1]: Failed to start Bitcoin's distributed currency daemon.
Feb 27 14:03:33 alaska systemd[1]: bitcoind.service: Unit entered failed state.
Feb 27 14:03:33 alaska systemd[1]: bitcoind.service: Failed with result 'exit-code'.
Feb 27 14:03:33 alaska systemd[1]: bitcoind.service: Service hold-off time over, scheduling restart.
Feb 27 14:03:33 alaska systemd[1]: Stopped Bitcoin's distributed currency daemon.
Feb 27 14:03:33 alaska systemd[1]: bitcoind.service: Start request repeated too quickly.
Feb 27 14:03:33 alaska systemd[1]: Failed to start Bitcoin's distributed currency daemon.
test@localhost:~$ cat /lib/systemd/system/bitcoind.service 
[Unit]
Description=Bitcoin's distributed currency daemon
After=network.target

[Service]
User=test
Group=test

Type=forking
PIDFile=/home/test/.bitcoin/bitcoind.pid
ExecStart=/home/test/.bitcoin/bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid \
-conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
test@localhost:~$ sudo vim /lib/systemd/system/bitcoind.service
test@localhost:~$ sudo systemctl daemon-reload
test@localhost:~$ which bitcoind
/usr/bin/bitcoind
test@localhost:~$ cat /lib/systemd/system/bitcoind.service 
[Unit]
Description=Bitcoin's distributed currency daemon
After=network.target

[Service]
User=test
Group=test

Type=forking
PIDFile=/home/test/.bitcoin/bitcoind.pid
ExecStart=/usr/bin/bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid \
-conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
test@localhost:~$ sudo systemctl start bitcoind
test@localhost:~$ sudo systemctl status bitcoind
● bitcoind.service - Bitcoin's distributed currency daemon
   Loaded: loaded (/lib/systemd/system/bitcoind.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-02-27 13:58:36 AEDT; 2s ago
  Process: 8627 ExecStart=/usr/bin/bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid -conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet (code=exited, status=0/SUCCESS)
 Main PID: 8628 (bitcoin-shutoff)
   CGroup: /system.slice/bitcoind.service
           └─8628 /usr/bin/bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid -conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet

Feb 27 13:58:36 alaska systemd[1]: bitcoind.service: Service hold-off time over, scheduling restart.
Feb 27 13:58:36 alaska systemd[1]: Stopped Bitcoin's distributed currency daemon.
Feb 27 13:58:36 alaska systemd[1]: Starting Bitcoin's distributed currency daemon...
Feb 27 13:58:36 alaska systemd[1]: Started Bitcoin's distributed currency daemon.
test@localhost:~$ ps -ef |grep -E '^test.*bitcoind'
test      8628     1  0 13:58 ?        00:00:00 /usr/bin/bitcoind -daemon -pid=/home/test/.bitcoin/bitcoind.pid -conf=/home/test/.bitcoin/bitcoin.conf -datadir=/home/test/.bitcoin/ -disablewallet
test      8643  7594  0 13:58 pts/2    00:00:00 grep --color=auto -E ^test.*bitcoind
test@localhost:~$ sudo systemctl stop bitcoind
test@localhost:~$ ps -ef |grep -E '^test.*bitcoind'
test      9012  7594  0 14:00 pts/2    00:00:00 grep --color=auto -E ^test.*bitcoind
test@localhost:~$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.