Workaround for certificate renewal error

2021-02-27

I've just spent too many minutes of my life dealing with this ultimately trivial issue, so let me record it for 89 days from now when it will come back.

I got a friendly email from the Let's Encrypt Expiry Bot telling me that the certificates on this webpage are about to expire. Since I had used certbot to get the certificates issued in the first place, the natural attempt was


sudo certbot renew

which failed miserably with


Failed to renew certificate aghitza.org with error: Problem binding to
port 80: Could not bind to IPv4 or IPv6.

After alternately googling the error and making random changes to my lighttpd.conf, I eventually realised that I should stop the web server, run the renewal command, then start the web server again:


sudo systemctl stop lighttpd
sudo certbot renew
sudo systemctl start lighttpd

Now I know.