<p>The environment variables need to be added to the <code>/home/ec2-user/relay/node.environment</code> file. Or you can specify them directly in <code>node-relay.service</code> file.</p>
<pre><code>[Service]
Type=simple
Environment=&quot;LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH&quot;
Environment=&quot;PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH&quot;

...

</code></pre>

CC BY-SA 4.0
2021-08-11T02:13:22.557Z
thanks, all makes sense now.
rob
CC BY-SA 4.0
2021-08-10T17:27:01.207Z
2021-08-10T17:27:01.207Z
Dmitri Safine
<p>i'm trying to run a node as a service using <code>systemctl start node-relay.service</code></p>
<p>i get this error, can anyone advise what i'm doing wrong.</p>
<p><code>/home/ec2-user/.local/bin/cardano-node: error while loading shared libraries: libsodium.so.23: cannot open shared object file: No such file or directory</code></p>
<p>my node-relay.service file looks like this</p>
<pre><code>Description= relay node
After=multi-user.target

[Service]
Type=simple
EnvironmentFile=/home/ec2-user/relay/node.environment
ExecStart=/home/ec2-user/.local/bin/cardano-node run --config $CONFIG --topology $TOPOLOGY --database-path $DBPATH --socket-path $SOCKETPATH --host-addr $HOSTADDR --port $PORT
KillSignal = SIGINT
RestartKillSignal = SIGINT
StandardOutput=journal
StandardError=journal
SyslogIdentifier=cardano-node

LimitNOFILE=32768

Restart=on-failure
RestartSec=15s
WorkingDirectory=~
User=ec2-user
Group=ec2-user

[Install]
WantedBy=multi-user.target
</code></pre>
<p>my .bashrc file contains</p>
<pre><code>export LD_LIBRARY_PATH=&quot;/usr/local/lib:$LD_LIBRARY_PATH&quot;
export PKG_CONFIG_PATH=&quot;/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH&quot;
export PATH=&quot;~/.local/bin:$PATH&quot;
</code></pre>
<p>the node starts fine if it run it like this;</p>
<p><code>cardano-node run --config ~/relay/testnet-config.json --database-path ~/relay/db --socket-path ~/relay/db/node.socket --host-addr 0.0.0.0 --port 3000</code></p>

CC BY-SA 4.0
2021-08-10T17:06:43.763Z
Are you aware of this post: https://forum.cardano.org/t/error-cardano-node-error-while-loading-shared-libraries-libsodium-so-23-cannot-open-shared-object-file-no-such-file-or-directory/39820 ? It refers to another one here https://forum.cardano.org/t/updating-stake-pool-school-config-files/37749/14 which recommends more or less what you did but with an additional step. Worth a try.
vcwebco
<cardano-node>
systemd service file for cardano node
# systemd service file for cardano node

(Asked by: username_0 on 2021-08-10)

i'm trying to run a node as a service using systemctl start node-relay.service
i get this error, can anyone advise what i'm doing wrong.
/home/ec2-user/.local/bin/cardano-node: error while loading shared libraries: libsodium.so.23: cannot open shared object file: No such file or directory
my node-relay.service file looks like this
Description= relay node
After=multi-user.target

[Service]
Type=simple
EnvironmentFile=/home/ec2-user/relay/node.environment
ExecStart=/home/ec2-user/.local/bin/cardano-node run --config $CONFIG --topology $TOPOLOGY --database-path $DBPATH --socket-path $SOCKETPATH --host-addr $HOSTADDR --port $PORT
KillSignal = SIGINT
RestartKillSignal = SIGINT
StandardOutput=journal
StandardError=journal
SyslogIdentifier=cardano-node

LimitNOFILE=32768

Restart=on-failure
RestartSec=15s
WorkingDirectory=~
User=ec2-user
Group=ec2-user

[Install]
WantedBy=multi-user.target

my .bashrc file contains
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH="~/.local/bin:$PATH"

the node starts fine if it run it like this;
cardano-node run --config ~/relay/testnet-config.json --database-path ~/relay/db --socket-path ~/relay/db/node.socket --host-addr 0.0.0.0 --port 3000

**Tags:** cardano-node
> **Comments:**
> **username_1**: Are you aware of this post: https://forum.cardano.org/t/error-cardano-node-error-while-loading-shared-libraries-libsodium-so-23-cannot-open-shared-object-file-no-such-file-or-directory/39820 ? It refers to another one here https://forum.cardano.org/t/updating-stake-pool-school-config-files/37749/14 which recommends more or less what you did but with an additional step. Worth a try.  

---

## 1 answers

### Answer by username_2 on 2021-08-10. Score: 2 | Accepted answer

The environment variables need to be added to the /home/ec2-user/relay/node.environment file. Or you can specify them directly in node-relay.service file.
[Service]
Type=simple
Environment="LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH"
Environment="PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

...

> **Comments:**
> **username_0**: thanks, all makes sense now.  

---

