xombiemp / ultimate-torrent-setup

All the files needed for the Ultimate Torrent Setup, featuring Ubuntu, rtorrent, ruTorrent, Sonarr, Radarr.
232 stars 44 forks source link

sudo update-caddy fails with error #85

Closed gavonmothma closed 2 years ago

gavonmothma commented 2 years ago

I have now gone through this for the Ubuntu version 3 times. Every time I get to this section:

`sudo systemctl restart php8.1-fpm.service

sudo dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy

sudo update-caddy

sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10

sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50

sudo systemctl start caddy.service

journalctl -u caddy.service | grep webadmin `

It fails on sudo update-caddy with error

Job for caddy.service failed because the control process exited with error code. See "systemctl status caddy.service" and "journalctl -xeu caddy.service" for details.

Output of systemctl status caddy.service: ` × caddy.service - Caddy Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/caddy.service.d └─override.conf Active: failed (Result: exit-code) since Sat 2022-09-03 23:33:04 UTC; 2min 27s ago Docs: https://caddyserver.com/docs/ Process: 30004 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=203/EXEC) Main PID: 30004 (code=exited, status=203/EXEC) CPU: 5ms

Sep 03 23:33:04 machinename systemd[1]: Starting Caddy... Sep 03 23:33:04 machinename systemd[30004]: caddy.service: Failed to locate executable /usr/bin/caddy: No such file or directory Sep 03 23:33:04 machinename systemd[30004]: caddy.service: Failed at step EXEC spawning /usr/bin/caddy: No such file or directory Sep 03 23:33:04 machinename systemd[1]: caddy.service: Main process exited, code=exited, status=203/EXEC Sep 03 23:33:04 machinename systemd[1]: caddy.service: Failed with result 'exit-code'. Sep 03 23:33:04 machinename systemd[1]: Failed to start Caddy.

`

Errors outputted by journalctl -xeu caddy.service Sep 03 23:33:04 machinename systemd[30004]: caddy.service: Failed at step EXEC spawning /usr/bin/caddy: No such file or directory Sep 03 23:33:04 machinename systemd[1]: caddy.service: Main process exited, code=exited, status=203/EXEC Sep 03 23:33:04 machinename systemd[1]: caddy.service: Failed with result 'exit-code'. Sep 03 23:33:04 machinename systemd[1]: Failed to start Caddy.

Ouput of ls /usr/bin/cad* /usr/bin/caddy.custom /usr/bin/caddy.default

So to try to fix it, I did this: sudo cp /usr/bin/caddy.custom /usr/bin/caddy

Then re-ran sudo update-caddy. This resulted in no errors the second time. No idea if this is the correct way to go about this. It fixed the issue but does this break something else?

xombiemp commented 2 years ago

You're right, that is confusing. That is actually an expected error. The update-caddy script attempts to start the caddy service at the end of it, but the binary isn't in place yet. The next two 'update-alternatives' commands create the binary file in the correct place.

I've modified the instructions to explicitly call the xcaddy build function rather than calling the update-caddy script. There should be no errors now.