<p>It looks like you have the bitcoind service listed as a <code>forking</code> service, but have not configured bitcoind as such. <code>forking</code> means that systemd expects the service to daemonize itself, i.e. the command it executes will exit once the service has started. However you have not configured bitcoind to behave in this way. So the bitcoind command that systemd runs will not exit as systemd is expecting it to. It is named <code>forking</code> because the process will call the <code>fork()</code> syscall and then the parent process will exit.</p>

<p>There are two solutions.</p>

<ol>
<li>Configure bitcoind to daemonize itself. You can do this by adding either <code>daemon=1</code> to your <code>bitcoin.conf</code> file or adding <code>-daemon</code> to the command in <code>ExecStart</code>.</li>
<li>Change your <code>bitcoind.service</code> file to say that bitcoind isn't expected to daemonize itself. To do this, change <code>Type=forking</code> to <code>Type=simple</code>. This instructs systemd to expect that the process configured with <code>ExecStart</code> will be the main process of the service.</li>
</ol>

CC BY-SA 4.0
2020-06-06T05:44:16.637Z
2020-06-06T05:44:16.637Z
Ava Chow
<p>I am trying to set up bitcoind to start at boot as a specific user. I see the process start for a minute and then fail, following boot.</p>

<p>I can start bitcoin as the user just fine with a login and then just run bitcoind. But I cannot pull the same trick off in a boot script.</p>

<pre><code>journlctl -b

Jun 05 16:43:09 mo.trader.com systemd[1]: bitcoind.service: Start operation timed out. Terminating.
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown requested. Exiting.
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown: In progress...
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z scheduler thread exit
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown: done
Jun 05 16:43:11 mo.trader.com systemd[1]: bitcoind.service: Control process exited, code=exited, status=1/FAILURE
Jun 05 16:43:11 mo.trader.com systemd[1]: bitcoind.service: Failed with result 'timeout'.
Jun 05 16:43:11 mo.trader.com systemd[1]: Failed to start bitcoin.
</code></pre>

<p>.</p>

<pre><code>cat /etc/systemd/system/bitcoind.service 
[Unit]
Description=bitcoin
#After=network.target
After=multi-user.target
Conflicts=rescue.target
AllowIsolate=yes


[Service]
Type=forking
User=bitcoinusr
Group=bitcoinusr

Environment=BITCOIN_PID=/mnt/bitcoin/bitcoin/bitcoind.pid
Environment=BITCOIN_HOME=/home/bitcoinusr/.bitcoin

ExecStart=/usr/local/bin/bitcoind
ExecStop=/bin/kill -15 $MAINPID

[Install]
#WantedBy=multi-user.target
Alias=default.target
</code></pre>

<p>.</p>

<pre><code>cat ../bitcoinusr/.bitcoin/bitcoin.conf 
blocksonly=1
dbcache=50
maxorphantx=10
maxmempool=100
datadir=/mnt/bitcoin/bitcoin
</code></pre>

<p>How do I get bitcoind to start at boot as user?</p>

<p>UPDATE:</p>

<p>It was a total systemd failure. it actually failed with 'service bitcoind start'. It just took a while to fail out.</p>

<bitcoind>
bitcoind fails to start at boot
brad
# bitcoind fails to start at boot

(Asked by: username_0 on 2020-06-05)

I am trying to set up bitcoind to start at boot as a specific user. I see the process start for a minute and then fail, following boot.

I can start bitcoin as the user just fine with a login and then just run bitcoind. But I cannot pull the same trick off in a boot script.

```
journlctl -b

Jun 05 16:43:09 mo.trader.com systemd[1]: bitcoind.service: Start operation timed out. Terminating.
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown requested. Exiting.
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown: In progress...
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z scheduler thread exit
Jun 05 16:43:09 mo.trader.com bitcoind[546]: 2020-06-05T15:43:09Z Shutdown: done
Jun 05 16:43:11 mo.trader.com systemd[1]: bitcoind.service: Control process exited, code=exited, status=1/FAILURE
Jun 05 16:43:11 mo.trader.com systemd[1]: bitcoind.service: Failed with result 'timeout'.
Jun 05 16:43:11 mo.trader.com systemd[1]: Failed to start bitcoin.

```

.

```
cat /etc/systemd/system/bitcoind.service 
[Unit]
Description=bitcoin
#After=network.target
After=multi-user.target
Conflicts=rescue.target
AllowIsolate=yes

[Service]
Type=forking
User=bitcoinusr
Group=bitcoinusr

Environment=BITCOIN_PID=/mnt/bitcoin/bitcoin/bitcoind.pid
Environment=BITCOIN_HOME=/home/bitcoinusr/.bitcoin

ExecStart=/usr/local/bin/bitcoind
ExecStop=/bin/kill -15 $MAINPID

[Install]
#WantedBy=multi-user.target
Alias=default.target

```

.

```
cat ../bitcoinusr/.bitcoin/bitcoin.conf 
blocksonly=1
dbcache=50
maxorphantx=10
maxmempool=100
datadir=/mnt/bitcoin/bitcoin

```

How do I get bitcoind to start at boot as user?

UPDATE:

It was a total systemd failure. it actually failed with 'service bitcoind start'. It just took a while to fail out.

**Tags:** bitcoind


---

## 1 answers

### Answer by username_1 on 2020-06-06. Score: 3 | Accepted answer

It looks like you have the bitcoind service listed as a `forking` service, but have not configured bitcoind as such. `forking` means that systemd expects the service to daemonize itself, i.e. the command it executes will exit once the service has started. However you have not configured bitcoind to behave in this way. So the bitcoind command that systemd runs will not exit as systemd is expecting it to. It is named `forking` because the process will call the `fork()` syscall and then the parent process will exit.

There are two solutions.

1. Configure bitcoind to daemonize itself. You can do this by adding either `daemon=1` to your `bitcoin.conf` file or adding `-daemon` to the command in `ExecStart`.
2. Change your `bitcoind.service` file to say that bitcoind isn't expected to daemonize itself. To do this, change `Type=forking` to `Type=simple`. This instructs systemd to expect that the process configured with `ExecStart` will be the main process of the service.


---

