Lets-Encrypt Auto - Corrupts Python on Renewal Hook

So I’ve got Let’s Encrypt working fine for over a year now, renewing manually every time it was necessary to do so. My last attempt for some reason does not go through, and it seems something is off with python. this is the error I get.

full domain name: aphil.org
the command line you ran: ./letsencrypt-auto renew --pre-hook “service nginx stop” --post-hook "service nginx start"
the output of that command:

Traceback (most recent call last):
File “/root/.local/share/letsencrypt/bin/pip”, line 11, in
sys.exit(main())
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/init.py”, line 233, in main
return command.main(cmd_args)
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/basecommand.py”, line 251, in main
timeout=min(5, options.timeout)) as session:
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/basecommand.py”, line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/download.py”, line 329, in init
self.headers[“User-Agent”] = user_agent()
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/download.py”, line 93, in user_agent
from pip._vendor import distro
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 1050, in
_distro = LinuxDistribution()
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 594, in init
if include_lsb else {}
File “/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 933, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout)
subprocess.CalledProcessError: Command ‘lsb_release -a’ returned non-zero exit status 1

name and version of your operating system and your web server: Debian 7
what type of hosting provider: it’s a VPS.

Now I am quite certain the issue is with Python, but I am not quite sure what I should do to resolve this.
Thanks.

Can you run lsb_release -a on your system? Or isn’t it installed?

Hi @babrak

have a look at this

I suspect that as part of the renewal the client is trying to upgrade itself

There is a solution in the article below

Andrei

This gives me the following result:

Traceback (most recent call last):
File "/usr/bin/lsb_release", line 28, in
import lsb_release
ImportError: No module named lsb_release

Which tells me that it isn't installed. But if I run 'sudo apt-get install lsb-release', I get the following:

lsb-release is already the newest version.
lsb-release set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Thanks for the reply. I am not sure what I am supposed to do from that post. I am not that knowledgeable about these issues. What I tried is to run this command ‘pip install certbot==0.11.1’, but it gives me error pip command not found.

So I guess pip is not installed, which is odd because it should be part of python, right? I decide to install pip via: sudo apt-get install python-pip

and the result is the following errors, so I am now stuck again:

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
python2.6 python2.6-minimal
Suggested packages:
python2.6-doc binfmt-support
Recommended packages:
python-dev-all
The following NEW packages will be installed:
python-pip python2.6 python2.6-minimal
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4168 kB of archives.
After this operation, 13.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously unselected package python2.6-minimal.
(Reading database … 29552 files and directories currently installed.)
Unpacking python2.6-minimal (from …/python2.6-minimal_2.6.8-1.1_amd64.deb) …
Selecting previously unselected package python2.6.
Unpacking python2.6 (from …/python2.6_2.6.8-1.1_amd64.deb) …
Selecting previously unselected package python-pip.
Unpacking python-pip (from …/python-pip_1.1-3_all.deb) …
Processing triggers for man-db …
Setting up python2.6-minimal (2.6.8-1.1) …
Linking and byte-compiling packages for runtime python2.6…
Traceback (most recent call last):
File “/usr/bin/pycentral”, line 2357, in
main()
File “/usr/bin/pycentral”, line 2347, in main
if action.check_args(global_options):
File “/usr/bin/pycentral”, line 1743, in check_args
for rt in get_installed_runtimes():
File “/usr/bin/pycentral”, line 278, in get_installed_runtimes
default_version = pyversions.default_version(version_only=True)
File “/usr/share/pycentral-data/pyversions.py”, line 172, in default_version
raise ValueError, “/usr/bin/python does not match the python default version. It must be reset to point to %s” % debian_default
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.7
dpkg: error processing python2.6-minimal (–configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python2.6:
python2.6 depends on python2.6-minimal (= 2.6.8-1.1); however:
Package python2.6-minimal is not configured yet.

dpkg: error processing python2.6 (–configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pip:
python-pip depends on python2.6; however:
Package python2.6 is not configured yet.

dpkg: error processing python-pip (–configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python2.6-minimal
python2.6
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)

Try some kind of forced reinstall.

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