I am trying to enable the Cloudflare DNS module but constantly get a ‘module not registered’ error.
2. Error messages and/or full log output:
merc@caddy:~$ sudo caddy reload --config /etc/caddy/Caddyfile
2023/05/11 07:30:52.565 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_dns': /etc/caddy/Caddyfile:2 - Error during parsing: getting module named 'dns.providers.cloudflare': module not registered: dns.providers.cloudflare
3. Caddy version:
v2.6.4
4. How I installed and ran Caddy:
Installed following recommended sudo apt install sudo method, then replaced caddy binary in both /bin and /usr/bin with downloaded version after selection amd64 arch/cloudflare module from download page. Then rebooted.
a. System environment:
Ubuntu 22 x86_64
b. Command:
Caddy is started automatically by service created with apt install. But error appears each time I run:
merc@caddy:/$ sudo systemctl status caddy
× caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-05-11 07:30:08 UTC; 22min ago
Docs: https://caddyserver.com/docs/
Process: 598 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 598 (code=exited, status=1/FAILURE)
CPU: 108ms
May 11 07:30:08 lnbits caddy[598]: LOGNAME=caddy
May 11 07:30:08 caddy caddy[598]: USER=caddy
May 11 07:30:08 caddy caddy[598]: INVOCATION_ID=e38cb54c6a3547a8aeaad0feefebd320
May 11 07:30:08 caddy caddy[598]: JOURNAL_STREAM=8:19091
May 11 07:30:08 caddy caddy[598]: SYSTEMD_EXEC_PID=598
May 11 07:30:08 caddy caddy[598]: {"level":"info","ts":1683790208.881809,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_ada>
May 11 07:30:08 caddy caddy[598]: Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_dns': /etc/caddy/Caddyfile:2 - Error during parsi>
May 11 07:30:08 caddy systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
May 11 07:30:08 caddy systemd[1]: caddy.service: Failed with result 'exit-code'.
May 11 07:30:08 caddy systemd[1]: Failed to start Caddy.
merc@caddy:/$ sudo caddy reload --config /etc/caddy/Caddyfile
2023/05/11 07:55:03.729 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_dns': /etc/caddy/Caddyfile:2 - Error during parsing: getting module named 'dns.providers.cloudflare': module not registered: dns.providers.cloudflare
c. Service/unit/compose file:
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateDevices=yes
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
Now you have the answer why the message is in the log .
The solution is to make again the download on Download Caddy or build your own binary with xcaddy
Well no just repeat the message from the download page.
Due to multiple outstanding bugs in the go command, we are aware that some downloads may hang or fail. In the meantime, you can download Caddy from the latest release on GitHub, or use xcaddy for custom builds. (Remember, this download page comes with no guarantees or SLAs.) Sorry for the inconvenience.
I would try to download as long as the module is in the binary or build my own based on xcaddy.
Thanks for your suggestions @al-caddyserver. It seems the curl download direct to the server wasn’t grabbing the correct version. When I did it manually on my Mac and SCP’ed it to the server the module now shows.