UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 1: ordinal not in range(128)

Hello,

two weeks ago I used certbot and haveing no troubles.
Now I’m getting the following when trying to request certificate once again:

certbot -d christian-burgert.de -d *.christian-burgert.de --manual --preferred-challenges dns certonly

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
An unexpected error occurred:
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0x82 in position 1: ordinal not in range(128)
Please see the logfiles in /var/log/letsencrypt for more details.


2018-07-25 08:24:16,844:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.25.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1323, in main
return config.func(config, plugins)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1206, in certonly
should_get_cert, lineage = _find_cert(config, domains, certname)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 285, in _find_cert
action, lineage = _find_lineage_for_domains_and_certname(config, domains, certname)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 312, in _find_lineage_for_domains_and_certname
return _find_lineage_for_domains(config, domains)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 256, in _find_lineage_for_domains
ident_names_cert, subset_names_cert = cert_manager.find_duplicative_certs(config, domains)
File “/usr/lib/python3/dist-packages/certbot/cert_manager.py”, line 166, in find_duplicative_certs
return _search_lineages(config, update_certs_for_domain_matches, (None, None))
File “/usr/lib/python3/dist-packages/certbot/cert_manager.py”, line 387, in _search_lineages
rv = func(candidate_lineage, rv, *args)
File “/usr/lib/python3/dist-packages/certbot/cert_manager.py”, line 154, in update_certs_for_domain_matches
candidate_names = set(candidate_lineage.names())
File “/usr/lib/python3/dist-packages/certbot/storage.py”, line 851, in names
return crypto_util.get_names_from_cert(f.read())
File “/usr/lib/python3.5/encodings/ascii.py”, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0x82 in position 1: ordinal not in range(128)
2018-07-25 08:24:16,846:ERROR:certbot.log:An unexpected error occurred:


SYSTEM INFO:
certbot --version
certbot 0.25.0


lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch


Also look for bad ASCII-Chars in my apache config
grep --color=‘auto’ -P -n “[^\x00-\x8F]” -r /etc/apache2
–> nothing found


Same when I using en_US.UTF-8:
LANG=en_US.UTF-8 certbot […]

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
An unexpected error occurred:
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x82 in position 1: invalid start byte
Please see the logfiles in /var/log/letsencrypt for more details.

Any idea?

The stack trace, to me, appears to be failing on a file name.

sudo find /etc/letsencrypt/{archive,live,renewal} -type f,l

Edit: on second thought, it’s probably the file contents, which might be a bit tricky. If you can add a

print(target)

immediately before:

 return crypto_util.get_names_from_cert(f.read())

in /usr/lib/python3/dist-packages/certbot/storage.py, it might reveal what the cause is.

1 Like

Cool thanks!

Find a corrupt text in a cert.

Now it works fine. Thanks!

1 Like

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