-1

I need to deploy my Go app to aws (ec2 instance), with Ubuntu 18.04, however I can't manage to make it run using the systemd. Here is my created service (/lib/systemd/system/go.service)

 [Unit]
 Description=go api

 [Service]
 Type=simple
 Restart=always
 RestartSec=5s
 ExecStart=/home/ubuntu/go/amutan

 [Install]
 WantedBy=multi-user.target

Here is the result when I run sudo service go start, sudo service go status

go.service - go api
Loaded: loaded (/lib/systemd/system/go.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2020-02-25 05
Process: 7326 ExecStart=/home/ubuntu/go/amutan (code=exited, status=203/EXEC)
Main PID: 7326 (code=exited, status=203/EXEC)

Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: Stopped go api.
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: Started go api.
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: go.service: Main process exited, code=exited, status=203/EXEC
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: go.service: Failed with result 'exit-code'.

My go binary resides in /home/ubuntu/go which is named amutan.

Any ideas?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
rai
  • 197
  • 2
  • 14

1 Answers1

1

That error message is in the official documentation as

203 EXIT_EXEC The actual process execution failed (specifically, the execve(2) system call). Most likely this is caused by a missing or non-accessible executable file.

So check permissions, the exact path and things like selinux settings

Vorsprung
  • 32,923
  • 5
  • 39
  • 63