1

I have problem with starting a systemd service of geth.

This is the service specification geth.service

[Unit]
Description=Geth

[Service] Type=simple User=eth Restart=always RestartSec=12 ExecStart=/home/eth/starteth.sh

[Install] WantedBy=default.target

This is the starteth.sh script

#!/usr/bin/env bash
geth --syncmode "fast" --rpc --rpcport "9820" --rpcaddr "127.0.0.1" --rpccorsdomain "*"

And I get error when start service and check status

root@server:~# sudo systemctl start geth
root@server:~# sudo systemctl status geth
● geth.service - Geth
   Loaded: loaded (/etc/systemd/system/geth.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2021-06-16 22:02:51 CEST; 3s ago
  Process: 19295 ExecStart=/home/eth/starteth.sh (code=exited, status=203/EXEC)
 Main PID: 19295 (code=exited, status=203/EXEC)

Edit: OS is Ubuntu 18

AdminBee
  • 22,803

2 Answers2

1

The starteth.sh is a shell script that expects to find an executable named geth somewhere in $PATH, but most likely it cannot be found as the $PATH used by systemd is quite minimal. Is there such a file anywhere? Try locate geth or find / -name geth to find it. Then prefix the geth in starteth.sh with the correct absolute path.

telcoM
  • 96,466
  • some issue. i dont know what to make more... – Stefan Simeonov Jun 17 '21 at 12:29
  • starteth.sh is looking for /bin/geth, /usr/bin/geth and/or /usr/local/bin/geth, but is not finding it. Do you have /home/eth/geth? If yes, then change the 2nd line of starteth.sh from geth --syncmode ... to /home/eth/geth --syncmode .... – telcoM Jun 17 '21 at 13:58
0

as the answer mentioned above to locate geth so yes file geth is present /usr/bin/geth

but sill the error is comming

× geth.service - Ethereum go client Loaded: loaded (/etc/systemd/system/geth.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2023-04-26 13:17:37 UTC; 2min 46s ago Process: 2862 ExecStart=/usr/bin/geth --networkid 9988 --datadir /opt/ethpoa2/node1/data --port 30303 --ipcdisable > Main PID: 2862 (code=exited, status=217/USER) CPU: 1ms

Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: geth.service: Failed with result 'exit-code'. Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: geth.service: Scheduled restart job, restart counter is at 5. Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: Stopped Ethereum go client. Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: geth.service: Start request repeated too quickly. Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: geth.service: Failed with result 'exit-code'. Apr 26 13:17:37 ip-172-31-87-252 systemd[1]: Failed to start Ethereum go client.