Sudden UTF-8 parsing error with Certbot

Hi,

I host multiple domains on a server.
I successfully had certbot running with certbot renew for years.

Suddenly I get

Attempting to renew cert (u-rte.com) from /etc/letsencrypt/renewal/u-rte.com.conf produced an unexpected error: 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte. Skipping.

Errors for some domains, but not all.

I have not touched those files and UTF-8 0xf6 (German ö) does not appear in the files:

# renew_before_expiry = 30 days
version = 0.40.0
archive_dir = /etc/letsencrypt/archive/u-rte.com
cert = /etc/letsencrypt/live/u-rte.com/cert.pem
privkey = /etc/letsencrypt/live/u-rte.com/privkey.pem
chain = /etc/letsencrypt/live/u-rte.com/chain.pem
fullchain = /etc/letsencrypt/live/u-rte.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account = c9cbf332e7fa4987867262a1cee515ad
authenticator = apache
installer = apache
server = https://acme-v02.api.letsencrypt.org/directory

Log is:

2023-08-15 16:24:31,372:INFO:certbot.renewal:Cert not yet due for renewal
2023-08-15 16:24:31,373:DEBUG:certbot.plugins.selection:Requested authenticator standalone and installer None
2023-08-15 16:24:31,378:DEBUG:certbot.storage:Should renew, less than 30 days before certificate expiry 2023-09-08 07:23:08 UTC.
2023-08-15 16:24:31,379:INFO:certbot.renewal:Cert is due for renewal, auto-renewing...
2023-08-15 16:24:31,379:DEBUG:certbot.plugins.selection:Requested authenticator apache and installer apache
2023-08-15 16:24:31,469:DEBUG:certbot_apache.configurator:Apache version is 2.4.41
2023-08-15 16:24:31,766:WARNING:certbot.renewal:Attempting to renew cert (u-rte.com) from /etc/letsencrypt/renewal/u-rte.com.conf produced an unexpected error: 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte. Skipping.
2023-08-15 16:24:31,767:DEBUG:certbot.renewal:Traceback was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/renewal.py", line 462, in handle_renewal_request
    main.renew_cert(lineage_config, plugins, renewal_candidate)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1202, in renew_cert
    installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 226, in choose_configurator_plugins
    installer = pick_installer(config, req_inst, plugins, installer_question)
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 30, in pick_installer
    return pick_plugin(
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 105, in pick_plugin
    verified.prepare()
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 252, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 252, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 130, in prepare
    self._initialized.prepare()
  File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 260, in prepare
    self.vhosts = self.get_virtual_hosts()
  File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 895, in get_virtual_hosts
    new_vhost = self._create_vhost(path)
  File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 871, in _create_vhost
    self._add_servernames(vhost)
  File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 821, in _add_servernames
    servername, serveraliases = self._get_vhost_names(host.path)
  File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 803, in _get_vhost_names
    serveralias = self.parser.get_arg(alias)
  File "/usr/lib/python3/dist-packages/certbot_apache/parser.py", line 660, in get_arg
    value = self.aug.get(match)
  File "/usr/lib/python3/dist-packages/augeas.py", line 147, in get
    return dec(value.value)
  File "/usr/lib/python3/dist-packages/augeas.py", line 65, in dec
    return st.decode(AUGENC)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte

Apache 2.4.41 @ Ubuntu 20.04.6; Certbot 0.40.0

Thanks for your time!

Hi @ThomasBarth, and welcome to the LE community forum :slight_smile:

I would replace the file:

with the clean contents shown:

And also test against the staging environment until this is resolved.

One of your Apache configuration files contains a non-valid, non-UTF character. Most likely the first character of one of the files looking at the error message.

Maybe grep can help:

grep -RP "\xf6" /etc/apache2/

(Not sure if your Apache dir is called apache2 tho, please change the directory if applicable.)

Yep, that was the issue. Grep did not show me the file but knowing what I had to look for I found the apache config file with the 0xf6 a.k. ö in it.

Thanks!