Forum archive
TK - Lets-Encrypt - dehydrated-wrapper - null $CTYPE
Hi y'all,
When I try to issue a certificate in Lets Encrpyt through confconsole in http-01 manually, everything goes well as follows:
[2024-06-23 10:13:27] dehydrated-wrapper: INFO: started
# INFO: Using main config file /etc/dehydrated/confconsole.config
+ Account already registered!
[2024-06-23 10:13:29] dehydrated-wrapper: INFO: found apache2 listening on port 80
[2024-06-23 10:13:29] dehydrated-wrapper: INFO: stopping apache2
[2024-06-23 10:13:30] dehydrated-wrapper: INFO: running dehydrated
# INFO: Using main config file /etc/dehydrated/confconsole.config
Processing myexampledomain.com
+ Checking domain name(s) of existing cert... unchanged.
+ Checking expire date of existing cert...
+ Valid till Jun 23 15:35:05 2024 GMT (Less than 30 days). Renewing!
+ Signing domains...
+ Generating private key...
+ Generating signing request...
+ Requesting new certificate order from CA...
+ Received 1 authorizations URLs from the CA
+ Handling authorization for myexampledomain.com
+ 1 pending challenge(s)
+ Deploying challenge tokens...
[2024-06-23 10:13:36] confconsole.hook.sh: INFO: Deploying challenge for myexampledomain.com
[2024-06-23 10:13:36] confconsole.hook.sh: INFO: Serving /var/lib/dehydrated/acme-challenges/(PRIVATE) on http://myexampledomain.com/.well-known/acme-challenge/(PRIVATE)
+ Responding to challenge for myexampledomain.com authorization...
+ Challenge is valid!
+ Cleaning challenge tokens...
[2024-06-23 10:13:40] confconsole.hook.sh: INFO: Clean challenge for myexampledomain.com
+ Requesting certificate...
+ Checking certificate...
+ Done!
+ Creating fullchain.pem...
[2024-06-23 10:13:43] confconsole.hook.sh: SUCCESS: Cert request successful. Writing relevant files for myexampledomain.com.
[2024-06-23 10:13:43] confconsole.hook.sh: INFO: fullchain: /var/lib/dehydrated/certs/myexampledomain.com/fullchain.pem
[2024-06-23 10:13:43] confconsole.hook.sh: INFO: keyfile: /var/lib/dehydrated/certs/myexampledomain.com/privkey.pem
[2024-06-23 10:13:43] confconsole.hook.sh: SUCCESS: Files written/created for myexampledomain.com: /usr/local/share/ca-certificates/cert.crt - /etc/ssl/private/cert.key - /etc/ssl/private/cert.pem.
+ Done!
[2024-06-23 10:13:43] dehydrated-wrapper: INFO: dehydrated complete
[2024-06-23 10:13:43] dehydrated-wrapper: WARNING: Python is still listening on port 80
[2024-06-23 10:13:43] dehydrated-wrapper: INFO: attempting to kill add-water server
[2024-06-23 10:13:43] dehydrated-wrapper: INFO: Cleaning backup cert & key
[2024-06-23 10:13:43] dehydrated-wrapper: INFO: (Re)starting apache2
[2024-06-23 10:13:43] dehydrated-wrapper: INFO: (Re)starting webmin.service
[2024-06-23 10:13:46] dehydrated-wrapper: INFO: dehydrated-wrapper completed successfully.But I don't know why i keep getting errors from the cron jobs:
[2024-06-23 10:14:02] dehydrated-wrapper: INFO: started
[2024-06-23 10:14:02] dehydrated-wrapper: FATAL: Unexpected challenge type:
[2024-06-23 10:14:02] dehydrated-wrapper: WARNING: Something went wrong, restoring original cert, key and combined files.
[2024-06-23 10:14:02] dehydrated-wrapper: INFO: (Re)starting webmin.service
[2024-06-23 10:14:05] dehydrated-wrapper: WARNING: Check today's previous log entries for details of error.
It's like $CTYPE is null.
$turnkey-version
turnkey-nextcloud-18.0-bookworm-amd64
$apt list confconsole
Listing... Done
confconsole/bookworm,now 2.1.5 all [installed]
I would post the letsencrypt.log here but it makes no sense since is only showing the same daily errors.
Could someone give me a help here?
It gives the full info when it works, but not when it doesn't!? (as it should).
TBH, I don't know why that's the case but there is a line in your logs that gives me some idea (albeit not real clarity on the issue). This is the line I'm talking about:
Note the colon at the end. That's where the full dehydrated error log should appear. Obviously it's not...
As it's only failing when it's run from the cron job, I suspect that it's something related to the cron job itself. FYI cron jobs run in a limited environment so it seems likely that there is something missing from the cron env.
Out of interest, does the Let's Encrypt error occur within 24 hours of manually running it? I ask because beyond the cron env, there is another fundamental difference between running it manually and via cron.
When it's run manually, it will force update of the cert - regardless of when the current cert will expire. Via cron it should only attempt to update the cert if it expires in 30 days or less. New certs are valid for 90 days. Given that log line I quote above, if the cron failure happens within 24 hours of the manual update, then that's another unexpected and weird component of this problem.
TBH, it's a real mystery why no one else has reported the issue you're hitting. FWIW we're dogfooding our LE integration - this server uses the same Let's Encrypt process that you are. Although actually, perhaps your server is a different TurnKey version and/or has a different version of Confconsole? IIRC this site was actually built before I built the publicly released images.
Regardless, can you please confirm the TurnKey version of your server and the version of Confconsole it's running. Here's how to do that respectively:
Re your suspicion that it's a $CTYPE issue, why do you think that? FYI if it's anything to do with the below message when installing/updating packages, then that's not an issue:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = (unset), LC_TIME = "en_AU.utf8", LC_MONETARY = "en_AU.utf8", LC_CTYPE = "C", LC_COLLATE = "C", LC_MEASUREMENT = "en_AU.utf8", LC_NUMERIC = "en_AU.utf8", LC_PAPER = "en_AU.utf8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = (unset), LC_TIME = "en_AU.utf8", LC_CTYPE = "C", LC_MONETARY = "en_AU.utf8", LC_COLLATE = "C", LC_MEASUREMENT = "en_AU.utf8", LC_NUMERIC = "en_AU.utf8", LC_PAPER = "en_AU.utf8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8").FYI, I copied that from a local v18.0 LAMP server I have running. I have not changed any of those server side. (Some are propagating via SSH from my local PC,