How to: Install Let’s Encrypt certificates

My nginx error log contains the following:

stack traceback:
coroutine 0:
        [C]: in function 'assert'
        /usr/share/lua/5.1/json/decode/state.lua:151: in function 'set_value'
        /usr/share/lua/5.1/json/decode.lua:84: in function 'decode'
        /usr/share/ssowat/config.lua:21: in function 'get_config'
        /usr/share/ssowat/access.lua:20: in function </usr/share/ssowat/access.lua:1>, client: [my IP], server:, reque$
2016/06/19 23:58:46 [error] 562#0: *4 lua entry thread aborted: runtime error: /usr/share/lua/5.1/json/decode/state.lua:151: Value set when one already in slot

Does anyone know what that means?


For information, I followed those step using the new letsencrypt script, certbot

/etc/ssowat/conf.json.persistent is

    "redirected_urls": {},
    "unprotected_urls" : [ 

/etc/nginx/conf.d/my.domain.d/certbot.conf is

location '/.well-known/acme-challenge' {
    default_type "text/plain";
    root        /etc/letsencrypt/webroot;

Then rougthly

sudo su
apt-get install certbot -t jessie-backports -y
mkdir /etc/letsencrypt/webroot
service nginx restart
cd /etc/yunohost
cp -r certs certs.backup
certbot certonly -d my.domain
# webroot into /etc/letsencrypt/webroot
cd /etc/yunohost/certs/my.domain
rm crt.pem key.pem
ln -sf /etc/letsencrypt/live/my.domain/privkey.pem key.pem
ln -sf /etc/letsencrypt/live/my.domain/fullchain.pem crt.pem
chown root:metronome /etc/letsencrypt/live /etc/letsencrypt/archive
chmod g+rx /etc/letsencrypt/live /etc/letsencrypt/archive

Last is automatical renewal with /etc/systemd/system/letsencrypt.service

Description=Renews letsencrypt certificates with certbot

ExecStart=/usr/bin/certbot renew

And a timer /etc/systemd/system/letsencrypt.timer

Description=letsencrypt timer



Last but not least, you need to reload nginx after a certificate renewal

mkdir /etc/systemd/system/letsencrypt.service.d

And /etc/systemd/system/letsencrypt.service.d/nginx.conf

ExecStartPost=/bin/systemctl reload nginx

A simple test

systemctl restart letsencrypt.service
journalctl -xn

Here’s my result

mercredi 22 juin 2016, 23:00:29 (UTC+0200)
juin 22 23:01:17 certbot[17723]: -------------------------------------------------------------------------------
juin 22 23:01:17 certbot[17723]: Processing /etc/letsencrypt/renewal/my.domain.conf
juin 22 23:01:17 certbot[17723]: -------------------------------------------------------------------------------
juin 22 23:01:17 certbot[17723]: The following certs are not due for renewal yet:
juin 22 23:01:17 certbot[17723]: /etc/letsencrypt/live/my.domain/fullchain.pem (skipped)
juin 22 23:01:17 certbot[17723]: No renewals were attempted.

Thanks @CaptainSqrt2 for the steps, this article for the systemd stuff and letsencrypt

1 Like

I am running Yunohost 2.2 and I installed letsencrypt 3 months ago using the web API.

I received last week a notification telling that my letsencrypt certificates have to be renewed (actually, I created them April 14th, so they are valid until July 13th):

Checking certificate ...
 > Needs to be renewed. Attempting to ...
 > An error occured, an email was sent.

But it didn’t worked:

Here is the log of what happened
Consider also checking /var/log/letsencrypt/

Upgrading certbot-auto 0.7.0 to 0.8.1…
Replacing certbot-auto…
Creating virtual environment…
Installing Python packages…
Installation succeeded.
Requested domain is not a FQDN

Any idea about what occurred? Thanks!

Has anybody succeeded the SSL certificate renewal?

I’ve installed Let’s Encrypt with the app on yunohost 2.3, then I’ve moved to 2.4, and my certificates were ok. But now the renewal has failed:

Checking domain.tld certificate ...
 > Needs to be renewed. Attempting to ...
rm: impossible de supprimer « /tmp/cron-cert-renewer.log »: Aucun fichier ou dossier de ce type
 > An error occured, an email was sent.
mail: invalid option -- 'r'
usage: mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-s subject] to-addr ...
       mail [-dEIiNnv] -f [name]
       mail [-dEIiNnv] [-u user]

Is there a way to repair this, or is it better to remove Let’s encrypt certificates and re-install manually like @rgarrigue did?


I finally renewed my certs by uninstalling then installing Let’s Encrypt via the web admin interface.

I renewed my certs by uninstalling and installing again too. Let’s Encrypt app worked well on yunohost 2.4 for me.
But when I uninstalled the app, I had problems with the original certs that weren’t set up correctly, and so nginx didn’t start. I just put them back manually using the backup in the folder /etc/yunohost/certs/domain.tld/domain.tld.beforeLetsEncrypt

Thanks for the app, it’s so easy to use! Now I’m just waiting for the next renewal, to see if it works.

Has --something changed recently with updates? I ask because a bunch of us all seem to have had the same issue come up at the same time recently.

My authentication URL’s just give 403’s or refused connection errors.

@aoz / @tomdereub - It sounds like you both solved this by uninstalling the certs manually and then installing the Let’s Encrypt Yunohost app. How did you do these steps? Did you just delete the certificate files?

Not manually.
I used the web admin interface to uninstall then re-install Let’s Encrypt app.

For me, I’ve uninstalled the app via the web admin interface too, but then I had nginx not working anymore, with certificates problems. So I had to copy the saved certificates present here : /etc/yunohost/certs/domain.tld/domain.tld.beforeLetsEncrypt (ca.pem ; crt.pem ; key.pem) to the folder /etc/yunohost/certs/domain.tld.
This made all working again with old certificates. Then I installed the app, and all worked automatically. I’m just waiting for the next certificates renewal to see if it’s working.

I also received the error “Requested domain is not a FQDN”, my domains all being in the form (no subdomain). I ran “/opt/yunohost/letsencrypt/letsencrypt-auto renew” manually and all certificates were renewed.

In the process of the above manual certificate renewal, I also noticed that removing a domain via the admin interface does not remove the domain from the letsencrypt configuration. That needs to be done manually.

Hi guys,

If you encounter this error, please check this fix from @juju : to be applied on /etc/cron.weekly/certificateRenewer


I can confirm that it has worked fine for me (yunohost 2.4)

Within the renewal script you are using an option ‘-r’ to specify the From address. This option is not available.

You might want to change it to something like:

-a “From: ${EMAIL_ALERT_FROM}”

I try several time to install Let’s Encrypt
It Failed to restart nginx
– I need to restart it by hand
and at the end info for let’s encrypt show : URL https://

I have few subdomain

Thanks @CaptainSqrt2 for linking to the fix. You saved me an evening of debugging :slight_smile:

Merci @CaptainSqrt2, et @juju aussi du coup, ça a marché nikel pour moi, le renouvellement c’est fait !
Et merci aussi @MarcusMoeller pour les envois de mails !

Juste un petit mot pour remercier tous ceux qui ont participé à cela.

Ca marche niquel !

Merci encore :wink: