ergochat / ergo

A modern IRC server (daemon/ircd) written in Go.
https://ergo.chat/
MIT License
2.2k stars 175 forks source link

Error code=exited status=203/exec #2155

Closed zyn23 closed 1 month ago

zyn23 commented 1 month ago

I made a specific user for running ergo called "ergo" :) When i go into this user and cd into the server direcory and run "./ergo run" everything works well... but I tried to create a service so the server would start when I turn de pc on. I do systemctl enable ergo and systemctl start ergo and dont get any error messages but when I do systemctl status ergo it shows this ergo.service - Ergo IRC server Loaded: loaded (/etc/systemd/system/ergo.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Wed 2024-05-22 13:47:11 WEST; 4s ago Duration: 2ms Process: 3874143 ExecStart=/home/ergo/server/start.sh (code=exited, status=203/EXEC) Main PID: 3874143 (code=exited, status=203/EXEC) CPU: 1ms I followed this guide https://landchad.net/irc/ and on the end of the "Connecting to the server" section there is a ergo.service example and I just copied and paste. (Yes the server is also on the same "server" directory like in the guide)

slingamn commented 1 month ago

Can you check systemctl status ergo.service as per this answer: https://unix.stackexchange.com/a/490707 ?

zyn23 commented 1 month ago

Same output as systemctl status ergo image I will check the SELinux option to see if is something related

zyn23 commented 1 month ago

It is not a SELinux related problem

slingamn commented 1 month ago

If you watch journalctl --follow while triggering the restart, do you see anything in the logs?

zyn23 commented 1 month ago

image Apparently there is an error with the format i think

slingamn commented 1 month ago

It's probably an issue either with the shebang line in start.sh, or that start.sh is not executable: https://stackoverflow.com/a/57025791

zyn23 commented 1 month ago

That fixed it! Thanks a lot! It was the shebang line. I wasn't specifying the shell

slingamn commented 1 month ago

Thanks! I should try and contact the Landchad maintainers to remove the start.sh recommendation, our suggested systemd unit file just points ExecStart directly at the ergo binary:

https://github.com/ergochat/ergo/blob/ca4b9c15c5c7e6009cd907e24fe31c2bf48a2083/distrib/systemd/ergo.service

slingamn commented 1 month ago

@termermc ^ thanks for your work on the landchad guide! Would you be able to update the guide according to the above recommendation? I think you would just have to delete the instruction to create start.sh, and then replace the current ExecStart with:

ExecStart=/home/ergo/server/ergo run

since you're already setting WorkingDirectory.