1

I've a machine with Ubuntu Server 16.04.4 LTS, the purpose of this machine is run a Geth process reachable by a web services.

This is my "unit service":

[Unit]
Description=Ethereum go client
[Service]
Type=simple
ExecStart=/usr/bin/geth --testnet --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303" --rpc --rpcapi="db,eth,net,web3,personal,web3" --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "*"

[Install]
WantedBy=default.target

I created this file (geth.ropsten.service) inside /etc/systemd/system and I executed this commands:

sudo systemctl enable geth.ropsten.service
sudo systemctl start geth.ropsten.service

If I reboot my machine I can view running process but it's not downloading the blockchain.

If I execute this command:

sudo systemctl status geth.ropsten.service

I can see this log but executions seems blocked:

● geth.ropsten.service - Ethereum go client                                                                                                                         
   Loaded: loaded (/etc/systemd/system/geth.ropsten.service; enabled; vendor preset: enabled)                                                                       
   Active: active (running) since Tue 2018-03-13 09:45:56 UTC; 44min ago                                                                                            
 Main PID: 2128 (geth)                                                                                                                                              
    Tasks: 9                                                                                                                                                        
   Memory: 52.7M                                                                                                                                                    
      CPU: 1min 18.495s                                                                                                                                             
   CGroup: /system.slice/geth.ropsten.service                                                                                                                       
           └─2128 /usr/bin/geth --testnet --fast --bootnodes enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02

Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576                   
Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Loaded most recent local full block      number=0 hash=419410…ca4a2d td=1048576                   
Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Loaded most recent local fast block      number=0 hash=419410…ca4a2d td=1048576                   
Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Loaded local transaction journal         transactions=0 dropped=0                                 
Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Regenerated local transaction journal    transactions=0 accounts=0                                
Mar 13 09:45:57 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:57] Starting P2P networking                                                                           
Mar 13 09:45:59 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:59] UDP listener up                          self=enode://073464f568d4166becc005bd1cdf8ebdfb6e74c6ca83
Mar 13 09:45:59 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:59] RLPx listener up                         self=enode://073464f568d4166becc005bd1cdf8ebdfb6e74c6ca83
Mar 13 09:45:59 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:59] HTTP endpoint opened                     url=http://0.0.0.0:8545 cors=* vhosts=localhost          
Mar 13 09:45:59 xdev-avgbc-node geth[2128]: INFO [03-13|09:45:59] IPC endpoint opened                      url=/root/.ethereum/testnet/geth.ipc

If I execute following command inside terminal I can see downloading the blockchain:

/usr/bin/geth --testnet --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303" --rpc --rpcapi="db,eth,net,web3,personal,web3" --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "*"

Why my process not download the blockchain?

EDIT

I changed daemon file adding two lines of code but without success:

[Unit]                                                                                                                                                              
Description=Ethereum go client                                                                                                                                      
After=network-online.target                                                                                                                           
Wants=network-online.target  
...

If I configure the daemon as user-service (adding the geth.ropsten.service on /etc/systemd/user) and I run this command:

sudo systemctl --user start geth.ropsten.service

Geth process start download the blockchain. Why?

Thanks

0

Hope this helps.

Create geth.service file (/etc/systemd/system/geth.service):

sudo nano /etc/systemd/system/geth.service

Paste the below (Change config in ExecStart to TestNet):

[Unit]
Description=Geth

[Service]
Type=simple
User={$USER}
Restart=always
RestartSec=12
ExecStart=/bin/geth --syncmode "full" --rpc --rpcaddr "0.0.0.0"

[Install]
WantedBy=default.target

Replace {$USER} with username above. Use useradd to create a newUser if required.

sudo useradd -d /home/newUser -m --uid 10000 newUser

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable geth.service
sudo systemctl daemon-reload

service geth status
sudo service geth start

Check the status:

service geth status

Attaching to geth instance:

geth attach

Stop and disable the service:

sudo service geth stop
sudo systemctl disable geth.service
sudo systemctl daemon-reload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.