2016-05-01 04:00:06,689:INFO:letsencrypt.cli:Could not choose appropriate plugin: The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError()
2016-05-01 04:00:06,690:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal/xxx.conf produced an unexpected error: The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(). Skipping.
but if I execute the same command manually, it workes without any errors
When something runs fine manually but fails when put in crontab, the most common reason is that the environment cron sees is not quite the same as yours. Basically if you do “env”, you will see a bunch of environment variables (such as PATH, etc). If whatever you run as cron relies on any of those variables, but they are missing - the task will fail. Some scripts can even fail if you don’t do “cd” into particular directory before executing the command
I’m not using the official client, but you could start with changing into the directory where the script is before executing it and see if that helped. You can simply add either
cd /root/.local/share/letsencrypt/bin/ &&
or
cd /root/.local/share/letsencrypt/bin/ ;
before the command.
The difference is that in the former case the command will be executed if directory change actually worked, in the latter it will be executed regardless of the “cd” outcome.
I’ve made an bash script with the following commands
#!/bin/sh
cd /root/.local/share/letsencrypt/bin/
/root/.local/share/letsencrypt/bin/letsencrypt renew
but I’ve got the same errors in the letsencrypt log file
2016-06-14 07:50:04,907:DEBUG:letsencrypt.storage:Should renew, less than 30 days before certificate expiry 2016-05-16 13:24:00 UTC.
2016-06-14 07:50:04,907:INFO:letsencrypt.cli:Cert is due for renewal, auto-renewing...
2016-06-14 07:50:04,910:DEBUG:letsencrypt.cli:Requested authenticator apache and installer apache
2016-06-14 07:50:04,912:DEBUG:letsencrypt.plugins.disco:No installation (PluginEntryPoint#apache):
Traceback (most recent call last):
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/plugins/disco.py", line 103, in prepare
self._initialized.prepare()
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 152, in prepare
raise errors.NoInstallationError
NoInstallationError
2016-06-14 07:50:04,912:DEBUG:letsencrypt.display.ops:No candidate plugin
2016-06-14 07:50:04,912:DEBUG:letsencrypt.display.ops:No candidate plugin
2016-06-14 07:50:04,912:DEBUG:letsencrypt.cli:Selected authenticator None and installer None
2016-06-14 07:50:04,912:INFO:letsencrypt.cli:Could not choose appropriate plugin: The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError()
am I really the only one who wants to auto renew the letsencrypt certificate with an cronjob on debian?
As I said earlier, it is usually because the cron sees a bit different environment. You may need to export extended PATH in that script you have created. See this thread as a reference on fixing similar issue: