<p>Have bitcoind.service file in /etc/systemd/system with the following contents:</p>
<hr />
<pre><code>[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/media/user/2TB/.bitcoin/bitcoind-start.sh

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

Type=forking
PIDFile=/media/user/2TB/.bitcoind/bitcoind.pid
Restart=on-failure

# Directory creation and permissions
####################################

User=user
Group=user


# Hardening measures
####################

PrivateTmp=true

PrivateDevices=true

MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target
</code></pre>
<hr />
<p>and also have a shell script with the following contents and execution rights -rwxr-xr-x 1 user user :</p>
<hr />
<pre><code>#!/binbash

set -e

sleep 15

echo &quot;Starting bitcoind with script...&quot;

bitcoind --daemon --server -pid=/media/user/2TB/.bitcoin/bitcoind.pid

echo &quot;Start bitcoind with script completed!&quot;
</code></pre>
<hr />
<p>The service won't start and exists with error:</p>
<pre><code>user@raspberrypi:~ $ systemctl status bitcoind.service

    × bitcoind.service - Bitcoin daemon
         Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; preset: enabled)
         Active: failed (Result: exit-code) since Mon 2024-04-01 12:57:32 BST; 13s ago
        Process: 5171 ExecStart=/media/user/2TB/.bitcoin/bitcoind-start.sh (code=exited, status=203/EXEC)
            CPU: 15ms
</code></pre>
<p>Any help or ideas why it is happening very appreciated!</p>
<p>Yuri</p>

CC BY-SA 4.0
2024-04-01T13:41:30.707Z
Anything in Bitcoin Core's debug.log file?
Pieter Wuille
CC BY-SA 4.0
2024-04-01T18:09:42.373Z
No new entries there. Needs to launch first to write anything to debug.log
jurijus01
CC BY-SA 4.0
2024-04-02T04:57:42.157Z
203 error code usually means some file was not found or there were insufficient privileges to access it. Perhaps that's happening because the shebang in your script is probably missing a `/`? It should be `#! /bin/bash`
Ava Chow
CC BY-SA 4.0
2024-04-04T07:27:55.000Z
Thanks a lot Ava! Well spotted. I'm new to bash scripts. In the .service file there is also typo in the path to .pid file - it should contain .bitcoin. There was an option to accept your answer to this thread and now it's gone? Now have corrected paths struggling with raspberrypi systemd[1]: bitcoind.service: Can't open PID file /media/user/2TB/.bitcoin/bitcoind.pid (yet?) after start: No such file or directory
jurijus01
<bitcoin-core><bitcoind><linux>
Bitcoind isn't starting as system service for some reason
jurijus01
# Bitcoind isn't starting as system service for some reason

(Asked by: username_0 on 2024-04-01)

Have bitcoind.service file in /etc/systemd/system with the following contents:

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

[Service]
ExecStart=/media/user/2TB/.bitcoin/bitcoind-start.sh

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

Type=forking
PIDFile=/media/user/2TB/.bitcoind/bitcoind.pid
Restart=on-failure

# Directory creation and permissions
####################################

User=user
Group=user


# Hardening measures
####################

PrivateTmp=true

PrivateDevices=true

MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target


and also have a shell script with the following contents and execution rights -rwxr-xr-x 1 user user :

#!/binbash

set -e

sleep 15

echo "Starting bitcoind with script..."

bitcoind --daemon --server -pid=/media/user/2TB/.bitcoin/bitcoind.pid

echo "Start bitcoind with script completed!"


The service won't start and exists with error:
user@raspberrypi:~ $ systemctl status bitcoind.service

    × bitcoind.service - Bitcoin daemon
         Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; preset: enabled)
         Active: failed (Result: exit-code) since Mon 2024-04-01 12:57:32 BST; 13s ago
        Process: 5171 ExecStart=/media/user/2TB/.bitcoin/bitcoind-start.sh (code=exited, status=203/EXEC)
            CPU: 15ms

Any help or ideas why it is happening very appreciated!
Yuri

**Tags:** bitcoin-core, bitcoind, linux

> **Comments:**
> **username_1**: Anything in Bitcoin Core's debug.log file?  
> **username_0**: No new entries there. Needs to launch first to write anything to debug.log  
> **username_2**: 203 error code usually means some file was not found or there were insufficient privileges to access it. Perhaps that's happening because the shebang in your script is probably missing a `/`? It should be `#! /bin/bash`  
> **username_0**: Thanks a lot Ava! Well spotted. I'm new to bash scripts. In the .service file there is also typo in the path to .pid file - it should contain .bitcoin. There was an option to accept your answer to this thread and now it's gone? Now have corrected paths struggling with raspberrypi systemd[1]: bitcoind.service: Can't open PID file /media/user/2TB/.bitcoin/bitcoind.pid (yet?) after start: No such file or directory  

---

## 0 answers

