Certbot --nginx error : UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 436: invalid continuation byte

Hello
I am a beginner with let's encrypt, and just install on my server. But I got this error about utf8
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 436: invalid continuation byte"

Extract from /var/log/letsencrypt/letsencrypt.log
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 436: invalid continuation byte
Please see the logfiles in /var/log/letsencrypt for more details.

My domain is: archeos.cdg44.fr

I ran this command: certbot --nginx -d archeos.cdg44.fr

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 436: invalid continuation byte
Please see the logfiles in /var/log/letsencrypt for more details.

My web server is (include version): debian10

The operating system my web server runs on is (include version): nginx 1.14.2

My hosting provider, if applicable, is: me

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): 0.31.0

Thanks for your help

1 Like

try manually use certonly and webroot authinator so it doesn't try to parse nginx config

ps: I'm going to sleep

2 Likes

Ok, thank you for your answer...but I really don't know how to do this ^^

1 Like

So, the problem is that your nginx config has some bytes in it which aren't valid UTF-8 characters. This may not be causing other problems, but it's certainly weird and is preventing certbot from understanding your config. So, you should probably find that byte, figure out what the configuration there should be, and fix it.

If you can't do that, then there are other ways to configure certbot, where instead of it trying to update your nginx configuration, you can tell it a "webroot" to place a file, where nginx is already configured to serve those files.

3 Likes

Thank you for your answer.
Do You mean the Vhost config ?

1 Like

I'm not particularly familiar with nginx configuration myself (though many other people here are), but I'm guessing it's whichever file has "byte 0xe9 in position 436" and probably shouldn't.

3 Likes

Yes, I get it, but I don't kwno which file is concerned ....

An nginx forum or its own docs are best places to learn about nginx. And, nginx can be installed in non-standard places. But, your initial conf file is probably here:

/etc/nginx/nginx.conf

That conf file probably includes other folders with conf files so you can follow those manually.

Normally you can see the whole nginx config with: sudo nginx -T
(uppercase T)

But, this may not work when there are errors in the config

In this case it looks like the character may be an accented e

Still, see the Certbot docs for instructions on using --webroot method. That may be needed in your case instead of --nginx method.

And, your Certbot version (and nginx version) are very old. Debian 10 is also now end of life. Updating at least Certbot may help.

3 Likes

This is actually the core of the problem.

Older versions of Certbot had a series of bugs where they would not work properly with foreign-language characters (like àèìòùäëïöü etc.), which might be mentioned in configuration files especially in comments like

# Esse é um comentário em português

# Ceci est un commentaire en français

All of these bugs were fixed in newer versions of Certbot over the past few years, but some people are still using very old versions of Certbot. Version 0.31.0 is a very old version.

Using such an old version usually means that you installed it from an operating system package that's not being kept up to date by the operating system maintainers (which is common on Debian, unfortunately!). If you check

you can find recommended installation methods for different operating systems, which, if followed, will get you a newer version of Certbot which shouldn't have this bug.

5 Likes

Yes, it's also a very good idea in general to get an operating system and other software that are receiving updates!

4 Likes

I didn't realize this, but the recommended Certbot installation methods for all Linux distributions are now down to just snap and pip!

3 Likes

Yes, their site was changed recently. Caught us all by surprise.

Each main install page still has the link for "Alternate" methods here ... Docker, pip, 3rd Party.
https://eff-certbot.readthedocs.io/en/latest/install.html

Presumably 3rd party includes the standard distro provided packaging system

3 Likes

Yes I've already checked my nginx.conf file, I didn't find any é neitheir in the VHost file.
So I supposed I need to upgrade my debian10 to bookworm...

Thank you for yor help

2 Likes

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