2

I have a cron set up to update certbot. It mails a deprecation warning every day. How do I stop the deprecation warning?

Cron <root@ip-99-99-99-99> /root/certbot-auto renew --quiet

/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning

I tried to file a bug report, but they closed it. https://github.com/certbot/certbot/issues/3984

I tried to install Python2.7 but I can't get certbot to run with Python2.7.

[root@kizbit ~]# scl enable python27 "python --version"
Python 2.7.8

[root@kizbit ~]# scl enable python27 "/root/certbot-auto renew"
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning

It still uses Python 2.6 and still produces a warning. I also tried:

[root@kizbit ~]# scl enable python27 "python /root/certbot-auto renew"
  File "/root/certbot-auto", line 18
    if [ -z "$XDG_DATA_HOME" ]; then
                           ^
SyntaxError: invalid syntax

WITH 2.6 IT WORKS BUT GIVES DEPRECATION:

[root@kizbit ~]# /root/certbot-auto renew
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning

Centos 6.8, certbot 0.12.0

Chloe
  • 1,164
  • 4
  • 19
  • 35

4 Answers4

0

Your issue got closed as it is a duplicate from that one, with links to further explanations.

There's no way around it: the Python version available on your system is getting old. Spamming "it is still happening" won't help, a member requested for help already. If that issue matters to your, feel free to contribute a PR.

Otherwise, I wouldn't recommend dropping certbot output to /dev/null, ... but if these warnings are really problematic, then you may consider just discarding them.

SYN
  • 1,751
  • 9
  • 14
0

Let's Encrypt community circa 2015 came up with a couple ways to get 2.7, CentOS software collections or third party repositories. Redhat / CentOS 6.x users need python 2.7

It amounts to installing the python27 packages and replacing python2 with python27 in the client. Maybe not strictly necessary since certbot is functional with 2.6, but a good exercise in getting newer software.

Long term you will want to migrate to newer versions of CentOS.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • But every time it updates itself (about every 2 weeks) then it will overwrite all the changes. That doesn't sound like a good idea. – Chloe Mar 03 '17 at 02:04
  • @Chloe Then turn off updates to certbot. You won't move to new version of the OS. Why would you want to get latest version of tools without the latest version of the OS to run them on? –  Mar 03 '17 at 03:02
  • It's impossible to upgrade the OS. I ran `yum upgrade` and it wouldn't update the OS. I'm not starting over and re-configuring everything on a new VPS. – Chloe Mar 06 '17 at 03:52
  • There are various ways to run an interpreter, such as using software collections and prefixing your certbot with "scl enable python27" I linked to a lets encrypt community forum, they had a couple more ideas. – John Mahowald Mar 07 '17 at 06:33
0

As a dirty, temporary workaround, you can try something like this in your cron entry:

certbot renew ... 2>&1 | grep -v DeprecationWarning
tuomassalo
  • 738
  • 2
  • 8
  • 22
0

I got Python2.7 installed on CentOS 6 with SCL.

yum install -y centos-release-scl
yum install -y python27
# scl enable python27 "python -V"
Python 2.7.8

Then you also have to delete

rm -r ~/.local/share/letsencrypt

And reinstall something Python 2.7 related (libraries? config?) by just running it plain

scl enable python27 "./certbot-auto"

Inside the crontab:

@daily scl enable python27 "/root/certbot-auto renew --quiet"
Chloe
  • 1,164
  • 4
  • 19
  • 35