OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: elhippo on January 06, 2025, 10:21:21 PM

Title: Caddy won't start
Post by: elhippo on January 06, 2025, 10:21:21 PM
Hi folks, I am a big fan of opnsense and all of its functionality but on one "machine" I have the problem that Caddy won't start.
All settings are okay, but in the logs the message

"error","ts":"2025-01-06T21:15:37Z","logger":"tls","msg":"could not clean default/global storage","error":"unable to acquire storage_clean lock: context canceled"}
appears and I don't know how to handle that. Rebooting opnsense and reinstalling did not help. The Firmware version is 24.7.11.

Any suggenstions solving this riddle would be appreciated!
Title: Re: Caddy won't start
Post by: Monviech (Cedrik) on January 07, 2025, 07:27:16 AM
Can you check what the startup log says in /var/log/caddy/caddy.log

Title: Re: Caddy won't start
Post by: Cerberus on January 15, 2025, 11:42:28 PM
I also have issues on 24.10.1 with caddy no longer starting. /var/log/caddy/caddy.log shows

Error: loading initial config: loading new config: setting up default log: opening log writer using &logging.NetWriter{Address:"unixgram//var/run/caddy/log.sock", DialTimeout:0, SoftStart:false, addr:caddy.NetworkAddress{Network:"unixgram", Host:"/var/run/caddy/log.sock", StartPort:0x0, EndPort:0x0}}: dial unixgram /var/run/caddy/log.sock: connect: no such file or directory
Error: caddy process exited with error: exit status 1

Starting it from console throw the same error:

# caddy run --config /usr/local/etc/caddy/Caddyfile
2025/01/15 22:44:05.709 INFO    using config from file  {"file": "/usr/local/etc/caddy/Caddyfile"}
2025/01/15 22:44:05.709 WARN    No files matching import glob pattern   {"pattern": "/usr/local/etc/caddy/caddy.d/*.global"}
2025/01/15 22:44:05.709 WARN    No files matching import glob pattern   {"pattern": "/usr/local/etc/caddy/caddy.d/*.conf"}
2025/01/15 22:44:05.712 INFO    adapted config to JSON  {"adapter": "caddyfile"}
Error: loading initial config: loading new config: setting up default log: opening log writer using &logging.NetWriter{Address:"unixgram//var/run/caddy/log.sock", DialTimeout:0, SoftStart:false, addr:caddy.NetworkAddress{Network:"unixgram", Host:"/var/run/caddy/log.sock", StartPort:0x0, EndPort:0x0}}: dial unixgram /var/run/caddy/log.sock: connect: no such file or directory

Deleting this the log section from Caddyfile let it start from console, but i prefer to have logs :)

        log {
                output net unixgram//var/run/caddy/log.sock {
                }
                format json {
                        time_format rfc3339
                }
        }
Title: Re: Caddy won't start
Post by: Monviech (Cedrik) on January 16, 2025, 06:57:50 AM
Can you check the directory if the file exists?

la -la /var/run/caddy/log,sock

If its not there, restart syslog to have it recreated. You can also delete it if the file is broken or has wrong permissions.

systemctl syslog restart

If it still does not appear we need to troubleshoot further.
Title: Re: Caddy won't start
Post by: Cerberus on January 21, 2025, 03:47:55 PM
Restarting syslog-ng didnt help and the file did not appear. I had a free slot to do a short maintanance reboot, now caddy is up again.
Title: Re: Caddy won't start
Post by: Monviech (Cedrik) on January 21, 2025, 03:58:46 PM
Okay thanks for checking back in. The log socket gets created by syslog-ng, here:

https://github.com/opnsense/plugins/blob/305af347b831d068dc6ee7b8eb1e2489afb5560b/www/caddy/src/etc/syslog-ng.conf.d/caddy.conf#L6-L9

The reboot probably restarted it properly so the socket was recreated.