Caddy service fails when not logged in

1. The problem I’m having:

I installed Caddy with go 1.21.1 using only the caddy-wol plugin, updated from Caddy 2.7.4 to 2.7.5 and the issue persisted. Im doing this in Debian 11 on a pi.

When I run systemctl enable --now caddy it works, but then when I reboot I see it always fails with status=2/INVALIDARGUMENT. I am struggling to find any relevant information to fix this and I believe I have everything set up correctly because when I remove --config /etc/caddy/Caddyfile it does run as expected.

2. Error messages and/or full log output:

I’m not really sure how to copy the text from the pi to here so I will add the lines I think are relevant manually and figure out a way to export the rest if that’s not enough or if requested

Process: 473 ExecStart=/usr/local/bin/caddy run --environ --config "/etc/caddy/Caddyfile" (code=exited, status=2)
...
some tls warnings..
...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x12a2190]
goroutine 1[running]:
...
a bunch of github repos in the logs starting with caddy-wol my plugin
...
caddy systemd[1]: caddy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
caddy systemd[1]: caddy.service: Failed with result 'exit-code' .

3. Caddy version:

I built with go 1.21.1, caddy 2.7.5, on Debian 11 on a pi

4. How I installed and ran Caddy:

I followed the instructions and installed go, xcaddy, etc.

a. System environment:

Debian 11 on a pi

b. Command:

sudo systemctl enable --now caddy

c. Service/unit/compose file:

systemd

d. My complete Caddy config:

I am able to run this with the config which I have validated, I am using only reverse proxy and caddy-wol

5. Links to relevant resources:

Thank you

Which instructions, exactly?

What do you see when you run caddy version?

Your logs should show the Caddy version it’s running because of --environ. Make sure that’s also 2.7.5.

Please show your full logs, not just sections of it. Make sure to read https://caddyserver.com/docs/running#using-the-service, we have a recommended command for looking at your logs.

Sorry, it took me a little while but I was able to get the logs and can get more things now.

Logs from journalctl from last boot. You can see after I logged in I ran it and it worked. I tried to redact my urls btw to a1, a2, a3, a4


-- Boot 57a322c6160e4163a6984dbc947dd824 --
Oct 30 18:49:29 caddy systemd[1]: Started Caddy HTTP/2 web server.
Oct 30 18:49:32 caddy caddy[473]: caddy.HomeDir=/root
Oct 30 18:49:32 caddy caddy[473]: caddy.AppDataDir=/root/.local/share/caddy
Oct 30 18:49:32 caddy caddy[473]: caddy.AppConfigDir=/root/.config/caddy
Oct 30 18:49:32 caddy caddy[473]: caddy.ConfigAutosavePath=/root/.config/caddy/autosave.json
Oct 30 18:49:32 caddy caddy[473]: caddy.Version=v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=
Oct 30 18:49:32 caddy caddy[473]: runtime.GOOS=linux
Oct 30 18:49:32 caddy caddy[473]: runtime.GOARCH=arm
Oct 30 18:49:32 caddy caddy[473]: runtime.Compiler=gc
Oct 30 18:49:32 caddy caddy[473]: runtime.NumCPU=4
Oct 30 18:49:32 caddy caddy[473]: runtime.GOMAXPROCS=4
Oct 30 18:49:32 caddy caddy[473]: runtime.Version=go1.21.1
Oct 30 18:49:32 caddy caddy[473]: os.Getwd=/
Oct 30 18:49:32 caddy caddy[473]: LANG=en_GB.UTF-8
Oct 30 18:49:32 caddy caddy[473]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Oct 30 18:49:32 caddy caddy[473]: HOME=/root
Oct 30 18:49:32 caddy caddy[473]: LOGNAME=root
Oct 30 18:49:32 caddy caddy[473]: USER=root
Oct 30 18:49:32 caddy caddy[473]: SHELL=/bin/sh
Oct 30 18:49:32 caddy caddy[473]: INVOCATION_ID=fc18c947fa6c4165bdbe619a8495edce
Oct 30 18:49:32 caddy caddy[473]: JOURNAL_STREAM=8:14578
Oct 30 18:49:32 caddy caddy[473]: {"level":"info","ts":1698706172.033477,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Oct 30 18:49:32 caddy caddy[473]: {"level":"info","ts":1698706172.099299,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//127.0.0.1:2019","//localhost:2019","//[::1]:2019"]}
Oct 30 18:49:32 caddy caddy[473]: {"level":"info","ts":1698706172.1029108,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x3b184e0"}
Oct 30 18:49:32 caddy caddy[473]: {"level":"info","ts":1698706172.1040614,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Oct 30 18:49:32 caddy caddy[473]: {"level":"info","ts":1698706172.1043956,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Oct 30 18:49:32 caddy caddy[473]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 30 18:49:32 caddy caddy[473]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x12a2190]
Oct 30 18:49:32 caddy caddy[473]: goroutine 1 [running]:
Oct 30 18:49:32 caddy caddy[473]: github.com/dulli/caddy-wol.(*Middleware).Cleanup(0x3d40a40)
Oct 30 18:49:32 caddy caddy[473]:         github.com/dulli/caddy-wol@v1.0.0/middleware.go:113 +0x1c
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x4, 0x4}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:352 +0x790
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.loadModuleInline({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x3, 0x4}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:397 +0xe8
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModule({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x3, 0x4}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:176 +0x734
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Route).ProvisionHandlers(0x3b05540, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x3, ...}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:154 +0x40
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.ProvisionHandlers({0x3b05540, 0x1, 0x1}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:209 +0x58
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Provision({0x3b05540, 0x1, 0x1}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:186 +0x88
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).Provision(0x3b1b550, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x3, ...}})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/subroute.go:58 +0x44
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3bbb820, 0x3, 0x4}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:347 +0x428
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.loadModuleInline({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3a8f7c0, 0x2, 0x2}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:397 +0xe8
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModule({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3a8f7c0, 0x2, 0x2}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:176 +0x734
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Route).ProvisionHandlers(0x3c88640, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3a8f7c0, 0x2, ...}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:154 +0x40
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.ProvisionHandlers({0x3c88640, 0x1, 0x1}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:209 +0x58
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Provision({0x3c88640, 0x1, 0x1}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:186 +0x88
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).Provision(0x3a8f760, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3a8f7c0, 0x2, ...}})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/subroute.go:58 +0x44
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3a8f7c0, 0x2, 0x2}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:347 +0x428
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.loadModuleInline({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3c722c8, 0x1, 0x1}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:397 +0xe8
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModule({{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3c722c8, 0x1, 0x1}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:176 +0x734
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Route).ProvisionHandlers(0x3c68090, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3c722c8, 0x1, ...}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:154 +0x40
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.ProvisionHandlers({0x3c68090, 0x2, 0x2}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:209 +0x58
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Provision({0x3c68090, 0x2, 0x2}, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, ...})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/routes.go:186 +0x88
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision(0x3b18480, {{0x1a411a4, 0x3c7e918}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3c722c8, 0x1, ...}})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/app.go:297 +0xc74
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x1a411c4, 0x3b0a0f0}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x3c722c8, 0x1, 0x1}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:347 +0x428
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Context.App({{0x1a411c4, 0x3b0a0f0}, 0x3afd0c0, 0x3b0a090, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}}, ...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/context.go:423 +0xf0
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.run.func3(...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/caddy.go:480
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.run(0x3b0a090, 0x1)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/caddy.go:485 +0x3b0
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.unsyncedDecodeAndRun({0x3b12800, 0x7a0, 0x800}, 0x1)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/caddy.go:338 +0x16c
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.changeConfig({0x157ce9c, 0x4}, {0x1583da1, 0x7}, {0x3b12000, 0x7a0, 0x800}, {0x0, 0x0}, 0x1)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/caddy.go:229 +0x7b0
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2.Load({0x3b12000, 0x7a0, 0x800}, 0x1)
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/caddy.go:128 +0x1c0
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/cmd.cmdRun({0x396d680})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/cmd/commandfuncs.go:231 +0x6d0
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/cmd.init.1.func2.WrapCommandFuncForCobra.func1(0x3aff800, {0x3be3c38, 0x0, 0x3})
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/cmd/cobra.go:137 +0x38
Oct 30 18:49:32 caddy caddy[473]: github.com/spf13/cobra.(*Command).execute(0x3aff800, {0x3be3c20, 0x3, 0x3})
Oct 30 18:49:32 caddy caddy[473]:         github.com/spf13/cobra@v1.7.0/command.go:940 +0x7a8
Oct 30 18:49:32 caddy caddy[473]: github.com/spf13/cobra.(*Command).ExecuteC(0x256c400)
Oct 30 18:49:32 caddy caddy[473]:         github.com/spf13/cobra@v1.7.0/command.go:1068 +0x410
Oct 30 18:49:32 caddy caddy[473]: github.com/spf13/cobra.(*Command).Execute(...)
Oct 30 18:49:32 caddy caddy[473]:         github.com/spf13/cobra@v1.7.0/command.go:992
Oct 30 18:49:32 caddy caddy[473]: github.com/caddyserver/caddy/v2/cmd.Main()
Oct 30 18:49:32 caddy caddy[473]:         github.com/caddyserver/caddy/v2@v2.7.5/cmd/main.go:66 +0x7c
Oct 30 18:49:32 caddy caddy[473]: main.main()
Oct 30 18:49:32 caddy caddy[473]:         caddy/main.go:12 +0x14
Oct 30 18:49:32 caddy systemd[1]: caddy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 30 18:49:32 caddy systemd[1]: caddy.service: Failed with result 'exit-code'.
Oct 30 18:53:48 caddy systemd[1]: Started Caddy HTTP/2 web server.
Oct 30 18:53:48 caddy caddy[624]: caddy.HomeDir=/root
Oct 30 18:53:48 caddy caddy[624]: caddy.AppDataDir=/root/.local/share/caddy
Oct 30 18:53:48 caddy caddy[624]: caddy.AppConfigDir=/root/.config/caddy
Oct 30 18:53:48 caddy caddy[624]: caddy.ConfigAutosavePath=/root/.config/caddy/autosave.json
Oct 30 18:53:48 caddy caddy[624]: caddy.Version=v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=
Oct 30 18:53:48 caddy caddy[624]: runtime.GOOS=linux
Oct 30 18:53:48 caddy caddy[624]: runtime.GOARCH=arm
Oct 30 18:53:48 caddy caddy[624]: runtime.Compiler=gc
Oct 30 18:53:48 caddy caddy[624]: runtime.NumCPU=4
Oct 30 18:53:48 caddy caddy[624]: runtime.GOMAXPROCS=4
Oct 30 18:53:48 caddy caddy[624]: runtime.Version=go1.21.1
Oct 30 18:53:48 caddy caddy[624]: os.Getwd=/
Oct 30 18:53:48 caddy caddy[624]: LANG=en_GB.UTF-8
Oct 30 18:53:48 caddy caddy[624]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Oct 30 18:53:48 caddy caddy[624]: HOME=/root
Oct 30 18:53:48 caddy caddy[624]: LOGNAME=root
Oct 30 18:53:48 caddy caddy[624]: USER=root
Oct 30 18:53:48 caddy caddy[624]: SHELL=/bin/sh
Oct 30 18:53:48 caddy caddy[624]: INVOCATION_ID=403e7fe47881490c9a86c79ce80c47b0
Oct 30 18:53:48 caddy caddy[624]: JOURNAL_STREAM=8:11693
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.6234171,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.6761577,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.6785362,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x33fb4a0"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.6796942,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.6799161,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.768512,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.7740285,"msg":"failed to sufficiently increase receive buffer size (was: 176 kiB, wanted: 2048 kiB, got: 352 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details."}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.7759168,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.776901,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.7772384,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["a1.a.in","a2.a.in","a3.a.in","a4.a.in"]}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.927163,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/root/.local/share/caddy"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.9365911,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.9368,"msg":"serving initial configuration"}
Oct 30 18:53:48 caddy caddy[624]: {"level":"info","ts":1698706428.93848,"logger":"tls","msg":"finished cleaning storage units"}

unit file

[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target

[Service]
User=root
Group=root
ExecStart=/usr/local/bin/caddy run --environ --config "/etc/caddy/Caddyfile"
ExecReload=/usr/local/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
ProtectSystem=true
PrivateTmp=true
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

Edit:

These instructions - Build from source — Caddy Documentation

plus a lot of blogs and posts from various places including here trying to debug

Edit 2: sorry i am disorganized on all this I appreciate your help very much.
I see 2.7.5 when I run caddy -v which I found was only added in 2.7.5

Ah okay, that’s a bug with the caddy-wol plugin then. It’s failing in that plugin’s code. Please reach out to the plugin’s maintainer for help.

1 Like

Thank you so much for your speedy replies and I apologize for not including the full log output in my initial post, I forgot I had set up a firewall lol

I opened an issue with the plugin repo, here is a link for any future readers Failing to launch caddy with only caddy-wol plugin on caddy 2.7.5 in go 1.21.1 on debian 11 · Issue #13 · dulli/caddy-wol · GitHub

GPT saved the day, after probing it about my error from the log snippet provided by francislavoie it told me about the middleware Cleanup() func. From there I realized it was failing to open a udp socket before login, but worked after login. So I kept asking questions and eventually it provided me with an answer + source(see above link).

My unit file needed to be like this.
After=network.target sockets.target network-online.target multi-user.target

Thank you again for your assistance!!! you guys are awesome

1 Like

Glad you figured it out. In the future, filling out the help template properly would have made this obvious, since our official unit file has those properties. :slight_smile:

@matt Agreed, I was impatient about figuring out why I couldn’t transfer my log files which I regret.

This was the unit file I was using, from the Keep Caddy Running page

However, I believe the After=... sockets.target multi-user.target was what I specifically needed to add for the caddy-wol plugin to work as a system service for debian/linux, and it does not need to be in there unless a plugin is attempting to set up a socket before that is available or perhaps something else.

I’m not sure that this type of plugin’s specific needs would fit in the official unit file but perhaps adding After=... multi-user.target might be worthwhile. I’m inexperienced in this domain and will leave it to the experts!

Thank you to both of you again for all you’ve done for Caddy!

Oh, I see, multi-user.target and sockets.target are not in the unit file; I scanned and only saw the other ones which are in our unit file already. Sorry about that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.