0

After executable command sudo certbox --nginx. Certbot give me output

Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 10453: ordinal not in range(128)
Please see the logfiles in /var/log/letsencrypt for more details.

This is a last log file

2018-07-31 14:43:08,904:DEBUG:certbot.main:certbot version: 0.25.1
2018-07-31 14:43:08,905:DEBUG:certbot.main:Arguments: ['--nginx']
2018-07-31 14:43:08,906:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2018-07-31 14:43:08,918:DEBUG:certbot.log:Root logging level set at 20
2018-07-31 14:43:08,919:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2018-07-31 14:43:08,920:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2018-07-31 14:43:08,967:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.25.1', 'console_scripts', 'certbot')()
  File "/usr/lib/python3.6/site-packages/certbot/main.py", line 1323, in main
    return config.func(config, plugins)
  File "/usr/lib/python3.6/site-packages/certbot/main.py", line 1073, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/usr/lib/python3.6/site-packages/certbot/plugins/selection.py", line 195, in choose_configurator_plugins
    authenticator = installer = pick_configurator(config, req_inst, plugins)
  File "/usr/lib/python3.6/site-packages/certbot/plugins/selection.py", line 25, in pick_configurator
    (interfaces.IAuthenticator, interfaces.IInstaller))
  File "/usr/lib/python3.6/site-packages/certbot/plugins/selection.py", line 77, in pick_plugin
    verified.prepare()
  File "/usr/lib/python3.6/site-packages/certbot/plugins/disco.py", line 246, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3.6/site-packages/certbot/plugins/disco.py", line 246, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3.6/site-packages/certbot/plugins/disco.py", line 127, in prepare
    self._initialized.prepare()
  File "/usr/lib/python3.6/site-packages/certbot_nginx/configurator.py", line 144, in prepare
    self.parser = parser.NginxParser(self.conf('server-root'))
  File "/usr/lib/python3.6/site-packages/certbot_nginx/parser.py", line 38, in __init__
    self.load()
  File "/usr/lib/python3.6/site-packages/certbot_nginx/parser.py", line 45, in load
    self._parse_recursively(self.config_root)
  File "/usr/lib/python3.6/site-packages/certbot_nginx/parser.py", line 66, in _parse_recursively
    self._parse_recursively(subentry[1])
  File "/usr/lib/python3.6/site-packages/certbot_nginx/parser.py", line 56, in _parse_recursively
    trees = self._parse_files(filepath)
  File "/usr/lib/python3.6/site-packages/certbot_nginx/parser.py", line 207, in _parse_files
    parsed = nginxparser.load(_file)
  File "/usr/lib/python3.6/site-packages/certbot_nginx/nginxparser.py", line 123, in load
    return loads(_file.read())
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 10453: ordinal not in range(128)
2018-07-31 14:43:08,969:ERROR:certbot.log:An unexpected error occurred:

Ugh, I use Arch.

2 Answers 2

1

When I last ran into this, it was an error with a non-ASCII character in the default nginx configuration that LetsEncrypt is attempting to read so it can add its own configuration. The following command was useful to find all non-ASCII characters (requires GNU grep for -P):

grep -Rn --color='auto' -P "[\x80-\xFF]" /etc/nginx

Specifically, take a close look at /etc/nginx/sites-enabled/default. On the system I just checked, it is a comment on line 29 starting with # ssl_protocols and that line contains non-ASCII characters (what is supposed to be the apostrophe in "don't" on that line) that is choking the LetsEncrypt setup.

You can either remove those characters from that file or disable the default configuration. Once it is not in the main nginx configuration, LetsEncrypt should no longer have that error.

0

Sounds like you have a random char in one of the nginx files that certbot is unable to read. Perhaps a character encoding on a file that doesn't match the characters entered into the document. Or a corrupt nginx file.

Check all of the virtual server files listed within /etc/nginx/conf.d/. Re-create each file with a plain text editor and save the files with the used/intended encoding.

1

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.