SSL certificate not updating

May 1, 2019 762 views
Miscellaneous DigitalOcean Python Debian

I installed an ssl certifictae few months ago and now its expired. When i am trying to update it using certbot renew, it give me a follwoing error. Any help will be greatly appreciated. Thanks
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/www.bureaubureau.dk.conf

Cert is due for renewal, auto-renewing…
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Traceback (most recent call last):
File “/usr/lib/python2.7/logging/init.py”, line 859, in emit
msg = self.format(record)
File “/usr/lib/python2.7/dist-packages/certbot/coloredlogging.py”, line 41, i n format
else super(StreamHandler, self).format(record))
File “/usr/lib/python2.7/logging/
init.py”, line 732, in format
return fmt.format(record)
File “/usr/lib/python2.7/logging/
init.py”, line 471, in format
record.message = record.getMessage()
File “/usr/lib/python2.7/logging/
init.py”, line 335, in getMessage
msg = msg % self.args
TypeError: _
str__ returned non-string (type Error)
Logged from file renewal.py, line 420
Traceback (most recent call last):
File “/usr/lib/python2.7/logging/handlers.py”, line 76, in emit
if self.shouldRollover(record):
File “/usr/lib/python2.7/logging/handlers.py”, line 156, in shouldRollover
msg = “%s\n” % self.format(record)
File “/usr/lib/python2.7/logging/init.py”, line 732, in format
return fmt.format(record)
File “/usr/lib/python2.7/logging/init.py”, line 471, in format
record.message = record.getMessage()
File “/usr/lib/python2.7/logging/init.py”, line 335, in getMessage
msg = msg % self.args
TypeError: str returned non-string (type Error)
Logged from file renewal.py, line 420


Processing /etc/letsencrypt/renewal/bureaubureau.dk.conf

Cert is due for renewal, auto-renewing…
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Traceback (most recent call last):
File “/usr/lib/python2.7/logging/init.py”, line 859, in emit
msg = self.format(record)
File “/usr/lib/python2.7/dist-packages/certbot/coloredlogging.py”, line 41, i n format
else super(StreamHandler, self).format(record))
File “/usr/lib/python2.7/logging/
init.py”, line 732, in format
return fmt.format(record)
File “/usr/lib/python2.7/logging/
init.py”, line 471, in format
record.message = record.getMessage()
File “/usr/lib/python2.7/logging/
init.py”, line 335, in getMessage
msg = msg % self.args
TypeError: _
str__ returned non-string (type Error)
Logged from file renewal.py, line 420
Traceback (most recent call last):
File “/usr/lib/python2.7/logging/handlers.py”, line 76, in emit
if self.shouldRollover(record):
File “/usr/lib/python2.7/logging/handlers.py”, line 156, in shouldRollover
msg = “%s\n” % self.format(record)
File “/usr/lib/python2.7/logging/init.py”, line 732, in format
return fmt.format(record)
File “/usr/lib/python2.7/logging/init.py”, line 471, in format
record.message = record.getMessage()
File “/usr/lib/python2.7/logging/init.py”, line 335, in getMessage
msg = msg % self.args
TypeError: str returned non-string (type Error)
Logged from file renewal.py, line 420

All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/www.bureaubureau.dk/fullchain.pem (failure)
/etc/letsencrypt/live/bureaubureau.dk/fullchain.pem (failure)
2 renew failure(s), 0 parse failure(s)

Can anyone tell me how to fix this issue. I have gone through similar questions but nothing helped. So please have a look!

3 comments
  • I tried these commands with -H

    -H pip install -U requests
    

    i get command not found.
    If i execute without -H

    pip install -U requests
    

    I get below exception:
    Cleaning up…
    Exception:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
    status = self.run(options, args)
    File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 290, in run
    requirementset.preparefiles(finder, forcerootegginfo=self.bundle, bundle=self.bundle)
    File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1097, in preparefiles
    reqtoinstall, self.upgrade)
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 194, in findrequirement
    page = self.getpage(mainindexurl, req)
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 568, in getpage
    session=self.session,
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 694, in getpage
    req, link, “connection error: %s” % exc, url,
    TypeError: _str
    _ returned non-string (type Error)

    Storing debug log for failure in /root/.pip/pip.log

  • @rokkjer

    You forgot sudo at the start of the command

    sudo -H pip install -U requests
    

    not

    -H pip install -U requests
    

    Please try again

  • sudo -H pip install -U requests
    

    i get the same response
    Cleaning up…
    Exception:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
    status = self.run(options, args)
    File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 290, in run
    requirementset.preparefiles(finder, forcerootegginfo=self.bundle, bundle=self.bundle)
    File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1097, in prepare
    files
    reqtoinstall, self.upgrade)
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 194, in findrequirement
    page = self.
    getpage(mainindexurl, req)
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 568, in _get
    page
    session=self.session,
    File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 694, in getpage
    req, link, “connection error: %s” % exc, url,
    TypeError: _
    str__ returned non-string (type Error)

    Storing debug log for failure in /root/.pip/pip.log

3 Answers

@rokkjer

Thanks for sharing your problem here.

I think that you have an issue with the version of urllib3 or requests package installed on your system please update them to the latest version and try again, use these commands:

sudo -H pip install -U requests
sudo -H pip install -U urllib3

Please let us know if this does not solve your issue.

Hope this helps, with best of luck from DO community :)

[deleted]
[deleted]
Have another answer? Share your knowledge.