# Letsencrypt renew / cron issue

**URL:** https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471
**Category:** Troubleshooting
**Created:** [20 June 2022 20:02 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471 "2022-06-20T20:02:48Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Rednox](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Rednox](https://dietpi.com/forum/u/Rednox)
#### Post date: [20 June 2022 20:02 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/1 "2022-06-20T20:02:48Z")

</div>

### Creating a bug report/issue

#### Required Information

- DietPi version | `cat /boot/dietpi/.version`  
G\_DIETPI\_VERSION\_CORE=8  
G\_DIETPI\_VERSION\_SUB=5  
G\_DIETPI\_VERSION\_RC=1  
G\_GITBRANCH=‘master’  
G\_GITOWNER=‘MichaIng’
- Distro version | `echo $G_DISTRO_NAME $G_RASPBIAN`  
bullseye
- Kernel version | `uname -a`  
5.10.110-meson64 #22.05.1 SMP PREEMPT Sat May 28 07:50:27 UTC 2022 aarch64 GNU/Linux
- SBC model | `echo $G_HW_MODEL_NAME` or (EG: RPi3)  
Odroid C4/HC4 (aarch64)
- Power supply used | (EG: 5V 1A RAVpower)
- SD card used | (EG: SanDisk ultra)

#### Additional Information (if applicable)

- Software title | (EG: Nextcloud)  
Nextcloud, Letsencrypt
- Was the software title installed freshly or updated/migrated?  
No
- Can this issue be replicated on a fresh installation of DietPi?  
I don’t know  
 ← If you sent a “dietpi-bugreport”, please paste the ID here → 
- Bug report ID | `echo $G_HW_UUID`  
e913f5ea-44de-4789-a438-5fa0c3af6af0

#### Steps to reproduce

1. Letsencrypt certificate is running out of validity
2. Certbot runs via cron to update it

#### Expected behaviour

- New Certificates get installed

#### Actual behaviour

- Certbot doesn’t update the certificates

#### Extra details

- I checked whether the cron daemon runs or not with the command:

> sudo journalctl -u cron.service | grep certbot

- which result was

> Jun 19 00:00:01 [my.domain.com](http://my.domain.com) CRON[1458679]: (root) CMD (test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(43200))’ && certbot -q renew)  
> Jun 19 12:00:02 [my.domain.com](http://my.domain.com) CRON[1496091]: (root) CMD (test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(43200))’ && certbot -q renew)  
> Jun 20 00:00:01 [my.domain.com](http://my.domain.com) CRON[1532602]: (root) CMD (test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(43200))’ && certbot -q renew)  
> Jun 20 12:00:01 [my.domain.com](http://my.domain.com) CRON[1570024]: (root) CMD (test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(43200))’ && certbot -q renew)

- if i run the following command manually, everything works fine but I want it to work automatically right

> sudo certbot renew

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [21 June 2022 12:15 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/2 "2022-06-21T12:15:54Z")

</div>

Short question, was the certificate already expired? Or was there still some days left? That’s basically a `certbot` own functionality to renew a certificate only if needed.

---

<div class="post-metadata">

### Author: ![Rednox](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Rednox](https://dietpi.com/forum/u/Rednox)
#### Post date: [23 June 2022 21:54 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/3 "2022-06-23T21:54:03Z")

</div>

Hey @Joulinar ,  
the certificate was already expired.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [24 June 2022 18:42 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/4 "2022-06-24T18:42:40Z")

</div>

The certificate if renewed via systemd timer instead of via cron job:

```bash
systemctl status certbot.timer
journalctl -u certbot

```

---

<div class="post-metadata">

### Author: ![Rednox](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Rednox](https://dietpi.com/forum/u/Rednox)
#### Post date: [25 June 2022 13:54 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/5 "2022-06-25T13:54:09Z")

</div>

I will have to check it again and don’t fix it manually if it occurs again. the certbot runs automatically but the certificate somehow wasn’t renewed by it.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [25 June 2022 14:23 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/6 "2022-06-25T14:23:20Z")

</div>

Did you tried to restart the web server before going to recreate the certificate manually? We had a case once where the certificate was correctly renewed by certbot but a web server restart was needed to have it accepted

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [25 June 2022 14:54 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/7 "2022-06-25T14:54:04Z")

</div>

Ah right, with Lighttpd the restart is still required.

---

<div class="post-metadata">

### Author: ![Rednox](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Rednox](https://dietpi.com/forum/u/Rednox)
#### Post date: [25 June 2022 14:57 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/8 "2022-06-25T14:57:04Z")

</div>

😄 you got me. That is my problem then. Nevertheless it is really bad for me e.g. if the cert runs out during vaca and i can’t access my privat network. I have to find a workaround then

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [25 June 2022 15:13 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/9 "2022-06-25T15:13:03Z")

</div>

Solved with: [v8.6 · MichaIng/DietPi@70f7fa2 · GitHub](https://github.com/MichaIng/DietPi/commit/70f7fa2)

Run this:

```bash
[[-d '/etc/letsencrypt/renewal-hooks/deploy']] || G_EXEC mkdir -p /etc/letsencrypt/renewal-hooks/deploy
G_EXEC eval 'echo -e '\''#!/bin/dash\nsystemctl reload lighttpd'\'' > /etc/letsencrypt/renewal-hooks/deploy/dietpi-lighttpd.sh'
G_EXEC chmod +x /etc/letsencrypt/renewal-hooks/deploy/dietpi-lighttpd.sh

```

Needs to be tested whether a “reload” is sufficient or a “restart” of the service required.

---

<div class="post-metadata">

### Author: ![Rednox](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Rednox](https://dietpi.com/forum/u/Rednox)
#### Post date: [25 June 2022 18:02 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/10 "2022-06-25T18:02:06Z")

</div>

@MichaIng  
I just tested it with a manuel forced renewal.  
reloading lighttpd was sufficient. THanks

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [25 June 2022 19:32 UTC](https://dietpi.com/forum/t/letsencrypt-renew-cron-issue/13471/11 "2022-06-25T19:32:46Z")

</div>

Many thanks for testing!
