Missing --run-deploy-hooks option in Certbot 2.6.0 installed using pip

I'm trying to test my deploy hook script (/etc/letsencrypt/renew-hooks/deploy/deploy.sh) with a dry run of certbot renew using the recent --run-deploy-hooks option described in the Certbot 2.6.0 documentation:

--dry-run Perform a test run against the Let's Encrypt staging
server, obtaining test (invalid) certificates but not
saving them to disk. This can only be used with the
'certonly' and 'renew' subcommands. It may trigger
webserver reloads to temporarily modify & roll back
configuration files. --pre-hook and --post-hook
commands run by default. --deploy-hook commands do not
run, unless enabled by --run-deploy-hooks. The test
server may be overridden with --server. (default:
False)

--run-deploy-hooks When performing a test run using --dry-run or
reconfigure, run any applicable deploy hooks. This
includes hooks set on the command line, saved in the
certificate's renewal configuration file, or present
in the renewal-hooks directory. To exclude directory
hooks, use --no-directory-hooks. The hook(s) will only
be run if the dry run succeeds, and will use the
current active certificate, not the temporary test
certificate acquired during the dry run. This flag is
recommended when modifying the deploy hook using
reconfigure. (default: False)

$ certbot --version
certbot 2.6.0
$ certbot --help renew
  --dry-run             Perform a test run against the Let's Encrypt staging
                        server, obtaining test (invalid) certificates but not
                        saving them to disk. This can only be used with the
                        'certonly' and 'renew' subcommands. It may trigger
                        webserver reloads to temporarily modify & roll back
                        configuration files. --pre-hook and --post-hook
                        commands run by default. --deploy-hook commands do not
                        run, unless enabled by --run-deploy-hooks. The test
                        server may be overridden with --server. (default:
                        False)
  --run-deploy-hooks    When performing a test run using `--dry-run` or
                        `reconfigure`, run any applicable deploy hooks. This
                        includes hooks set on the command line, saved in the
                        certificate's renewal configuration file, or present
                        in the renewal-hooks directory. To exclude directory
                        hooks, use --no-directory-hooks. The hook(s) will only
                        be run if the dry run succeeds, and will use the
                        current active certificate, not the temporary test
                        certificate acquired during the dry run. This flag is
                        recommended when modifying the deploy hook using
                        `reconfigure`. (default: False)

Here is the command I use:

$ certbot --version
certbot 2.6.0
$ sudo certbot renew --dry-run --run-deploy-hooks
usage: 
  certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate. 
certbot: error: unrecognized arguments: --run-deploy-hooks

Am I using the --run-deploy-hooks option incorrectly?

1 Like

I think it's almost certainly the case that sudo certbot --version will show an older version of Certbot. The root user will have some other version of Certbot in their $PATH.

4 Likes

You're right.

$ certbot --version
certbot 2.6.0
$ sudo certbot --version
certbot 2.2.0
$ which certbot
~/.local/bin/certbot
$ sudo which certbot
/bin/certbot
$ sudo find / -name certbot
/usr/bin/certbot
/home/opc/.local/lib/python3.9/site-packages/certbot
/home/opc/.local/bin/certbot
/opt/certbot
/opt/certbot/lib/python3.9/site-packages/certbot
/opt/certbot/bin/certbot

When upgrading Certbot, I forgot that installing certbot using pip requires a few additional steps. Here's the correct way to upgrade a Certbot pip installation:

sudo /opt/certbot/bin/pip install --upgrade certbot

Thanks for the help!

3 Likes

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