certbot-auto is setup to run every 12 hours via cron and usually runs without issue. But twice in the last two months, certbot-auto will exit with the below virtualenv error, and cron sends me a failure email. I'd like to see if there is a reason for these failures or if we should just ignore them.
First failure happened on Jan 3rd, and second on Jan 25th.
I ran this command: sudo /etc/letsencrypt/certbot-auto renew -q
It produced this output:
/etc/letsencrypt/certbot-auto: line 1004: virtualenv: command not found
My web server is (include version):
apache
The operating system my web server runs on is (include version):
$ lsb_release -d
Description: Ubuntu 16.04.5 LTS
I can login to a root shell on my machine (yes or no, or I don't know): yes
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
$ sudo /etc/letsencrypt/certbot-auto --version
certbot 0.30.1
A coworker pointed out that virtualenv is installed in several ways.
which virtualenv --> /usr/local/bin/virtualenv
dpkg --listfiles virtualenv --> /usr/bin/virtualenv [which does not exist ]
$ pip list | grep virt
virtualenv 16.0.0
virtualenv-clone 0.3.0
[/usr/local/bin/virtualenv is installed via pip]
dpkg --get-selections|grep virtualenv
python-virtualenv install
python3-virtualenv install
virtualenv install
Which I think is throwing off the script. I think it sees that virtualenv package is installed and expects virtualenv to be in the path, but it is in /usr/local/bin instead and it cannot find it. I don’t think /usr/local/bin is in the PATH for root crontab.