So, let’s say that I mistakenly deleted the .pem file from my server … and then restored it by copying it from a backup and pasting it back to my server, with sudo nano … and pasting the text.
And now:
sudo /usr/local/bin/certbot-auto renew -q
Traceback (most recent call last):
File "/opt/eff.org/certbot/venv/lib64/python3.6/site-packages/certbot/_internal/renewal.py", line 63, in _reconstitute
renewal_candidate = storage.RenewableCert(full_path, config)
File "/opt/eff.org/certbot/venv/lib64/python3.6/site-packages/certbot/_internal/storage.py", line 466, in __init__
self._check_symlinks()
File "/opt/eff.org/certbot/venv/lib64/python3.6/site-packages/certbot/_internal/storage.py", line 533, in _check_symlinks
"expected {0} to be a symlink".format(link))
certbot.errors.CertStorageError: expected /etc/letsencrypt/live/mysite.com/fullchain.pem to be a symlink
Renewal configuration file /etc/letsencrypt/renewal/mysite.com.conf is broken. Skipping.
0 renew failure(s), 1 parse failure(s)
This work good, sudo /usr/local/bin/certbot-auto --apache
What can I do?
I thought about uninstalling and reinstalling certbot, but I wouldn’t want to make even worse messes …
The files in the /live/ directory are actually symbolic links to the files in /archive/. So if you only removed the symbolic link, you can just remake the symbolic link with the ln -s command (see man ln). It points to the corresponding file in /archive/ with the higest number. I.e., the file fullchain.pem in /live/example.com would point to ../../archive/example.com/fullchain23.pem if “23” would be the higest number. Same goes for privkey.pem -> ../../archive/example.com/privkey23.pem et cetera.