Certbot Renew Fails when in Crontab but not when typed in?

I have the below command in crontab.

it fails.

when I run it at the command prompt as ‘certbot renew’ it completed successfully.

any ideas? running in the root crontab.

My domain is: nomorestars.com

I ran this command: /usr/bin/certbot renew --quiet --preferred-challenges http

It produced this output:

019-04-27 03:15:02,328:DEBUG:certbot.main:certbot version: 0.31.0
2019-04-27 03:15:02,328:DEBUG:certbot.main:Arguments: [’–quiet’, ‘–preferred-challenges’, ‘http’]
2019-04-27 03:15:02,329:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2019-04-27 03:15:02,373:DEBUG:certbot.log:Root logging level set at 30
2019-04-27 03:15:02,373:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2019-04-27 03:15:02,395:DEBUG:certbot.plugins.selection:Requested authenticator <certbot.cli._Default object at 0x7f0ca9934790> and installer <certbot.cli._Default object at 0x7f0ca9934790>
2019-04-27 03:15:02,395:DEBUG:certbot.cli:Var pref_challs=http (set by user).
2019-04-27 03:15:02,407:DEBUG:certbot.storage:Should renew, less than 30 days before certificate expiry 2019-05-07 23:27:51 UTC.
2019-04-27 03:15:02,407:INFO:certbot.renewal:Cert is due for renewal, auto-renewing…
2019-04-27 03:15:02,407:INFO:certbot.renewal:Non-interactive renewal: random delay of 270 seconds
2019-04-27 03:19:32,479:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2019-04-27 03:19:32,481:DEBUG:certbot.plugins.disco:No installation (PluginEntryPoint#nginx): Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/certbot/plugins/disco.py”, line 132, in prepare
self._initialized.prepare()
File “/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py”, line 145, in prepare
"Could not find a usable ‘nginx’ binary. Ensure nginx exists, "
NoInstallationError: Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.
2019-04-27 03:19:32,484:DEBUG:certbot.plugins.selection:No candidate plugin
2019-04-27 03:19:32,484:DEBUG:certbot.plugins.selection:No candidate plugin
2019-04-27 03:19:32,484:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
2019-04-27 03:19:32,484:INFO:certbot.main:Could not choose appropriate plugin: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,)
2019-04-27 03:19:32,484:WARNING:certbot.renewal:Attempting to renew cert (nomorestars.com) from /etc/letsencrypt/renewal/nomorestars.com.conf produced an unexpected error: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,). Skipping.
2019-04-27 03:19:32,488:DEBUG:certbot.renewal:Traceback was:
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/certbot/renewal.py”, line 452, in handle_renewal_request
main.renew_cert(lineage_config, plugins, renewal_candidate)
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 1187, in renew_cert
installer, auth = plug_sel.choose_configurator_plugins(config, plugins, “certonly”)
File “/usr/lib/python2.7/site-packages/certbot/plugins/selection.py”, line 237, in choose_configurator_plugins
diagnose_configurator_problem(“authenticator”, req_auth, plugins)
File “/usr/lib/python2.7/site-packages/certbot/plugins/selection.py”, line 341, in diagnose_configurator_problem
raise errors.PluginSelectionError(msg)
PluginSelectionError: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,)

2019-04-27 03:19:32,491:DEBUG:certbot.cli:Var pref_challs=http (set by user).
2019-04-27 03:19:32,497:DEBUG:certbot.storage:Should renew, less than 30 days before certificate expiry 2019-05-07 23:28:00 UTC.
2019-04-27 03:19:32,497:INFO:certbot.renewal:Cert is due for renewal, auto-renewing…
2019-04-27 03:19:32,497:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2019-04-27 03:19:32,498:DEBUG:certbot.plugins.disco:No installation (PluginEntryPoint#nginx): Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/certbot/plugins/disco.py”, line 132, in prepare
self._initialized.prepare()
File “/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py”, line 145, in prepare
"Could not find a usable ‘nginx’ binary. Ensure nginx exists, "
NoInstallationError: Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.
2019-04-27 03:19:32,498:DEBUG:certbot.plugins.selection:No candidate plugin
2019-04-27 03:19:32,498:DEBUG:certbot.plugins.selection:No candidate plugin
2019-04-27 03:19:32,499:DEBUG:certbot.plugins.selection:Selected authenticator None and installer None
2019-04-27 03:19:32,499:INFO:certbot.main:Could not choose appropriate plugin: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,)
2019-04-27 03:19:32,499:WARNING:certbot.renewal:Attempting to renew cert (pod.nomorestars.com) from /etc/letsencrypt/renewal/pod.nomorestars.com.conf produced an unexpected error: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,). Skipping.
2019-04-27 03:19:32,500:DEBUG:certbot.renewal:Traceback was:
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/certbot/renewal.py”, line 452, in handle_renewal_request
main.renew_cert(lineage_config, plugins, renewal_candidate)
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 1187, in renew_cert
installer, auth = plug_sel.choose_configurator_plugins(config, plugins, “certonly”)
File “/usr/lib/python2.7/site-packages/certbot/plugins/selection.py”, line 237, in choose_configurator_plugins
diagnose_configurator_problem(“authenticator”, req_auth, plugins)
File “/usr/lib/python2.7/site-packages/certbot/plugins/selection.py”, line 341, in diagnose_configurator_problem
raise errors.PluginSelectionError(msg)
PluginSelectionError: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”,)

2019-04-27 03:19:32,500:ERROR:certbot.renewal:All renewal attempts failed. The following certs could not be renewed:
2019-04-27 03:19:32,500:ERROR:certbot.renewal: /etc/letsencrypt/live/nomorestars.com/fullchain.pem (failure)
/etc/letsencrypt/live/pod.nomorestars.com/fullchain.pem (failure)
2019-04-27 03:19:32,500:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 9, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 1365, in main
return config.func(config, plugins)
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 1272, in renew
renewal.handle_renewal_request(config)
File “/usr/lib/python2.7/site-packages/certbot/renewal.py”, line 477, in handle_renewal_request
len(renew_failures), len(parse_failures)))
Error: 2 renew failure(s), 0 parse failure(s)

My web server is (include version):

nginx version: nginx/1.12.2

The operating system my web server runs on is (include version):

centos 7 w/lates updates

My hosting provider, if applicable, is:

dropbox drople

I can login to a root shell on my machine (yes or no, or I don’t know):

yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):

certbot 0.31.0

Hi @trekkie

that's a typical problem if crontab has other path definitions.

Use crontab -e to edit, add something like

PATH=/sbin:/bin:/usr/sbin:/usr/bin

to add a path.

Use the result of your interactive, working version.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.