(Solved) Certbot apache error: AttributeError: 'NoneType' object has no attribute 'startswith'

Issues related to applications and software problems
Post Reply
MuDeKi
Posts: 7
Joined: 2018/02/21 15:05:55

(Solved) Certbot apache error: AttributeError: 'NoneType' object has no attribute 'startswith'

Post by MuDeKi » 2019/01/18 14:17:25

When using certbot with the apache plugins I am having problems. It gives me errors about a python script, but I have no idea how to solve it. But I need to get certbot with apache module working. Since I need to update my certificates and doing it manually is way too labor intensive. Anyone any idea what I could do?

When I run anything with certbot --apache I am getting: AttributeError: 'NoneType' object has no attribute 'startswith'

Code: Select all

certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
AttributeError: 'NoneType' object has no attribute 'startswith'
Please see the logfiles in /var/log/letsencrypt for more details.
The log gives me not much more information about what I could do to fix it:

Code: Select all

2019-01-18 15:13:40,609:DEBUG:certbot.main:certbot version: 0.29.1
2019-01-18 15:13:40,609:DEBUG:certbot.main:Arguments: ['--apache']
2019-01-18 15:13:40,609:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2019-01-18 15:13:40,635:DEBUG:certbot.log:Root logging level set at 20
2019-01-18 15:13:40,635:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2019-01-18 15:13:40,636:DEBUG:certbot.plugins.selection:Requested authenticator apache and installer apache
2019-01-18 15:13:40,853:DEBUG:certbot_apache.configurator:Apache version is 2.4.6
2019-01-18 15:13:41,148:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==0.29.1', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 1352, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 1078, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/usr/lib/python2.7/site-packages/certbot/plugins/selection.py", line 225, in choose_configurator_plugins
    authenticator = installer = pick_configurator(config, req_inst, plugins)
  File "/usr/lib/python2.7/site-packages/certbot/plugins/selection.py", line 25, in pick_configurator
    (interfaces.IAuthenticator, interfaces.IInstaller))
  File "/usr/lib/python2.7/site-packages/certbot/plugins/selection.py", line 106, in pick_plugin
    verified.prepare()
  File "/usr/lib/python2.7/site-packages/certbot/plugins/disco.py", line 251, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python2.7/site-packages/certbot/plugins/disco.py", line 132, in prepare
    self._initialized.prepare()
  File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 252, in prepare
    self.parser = self.get_parser()
  File "/usr/lib/python2.7/site-packages/certbot_apache/override_centos.py", line 48, in get_parser
    self.version, configurator=self)
  File "/usr/lib/python2.7/site-packages/certbot_apache/override_centos.py", line 56, in __init__
    super(CentOSParser, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 55, in __init__
    self.update_runtime_variables()
  File "/usr/lib/python2.7/site-packages/certbot_apache/override_centos.py", line 61, in update_runtime_variables
    super(CentOSParser, self).update_runtime_variables()
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 148, in update_runtime_variables
    self.update_includes()
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 180, in update_includes
    _ = self.find_dir("Include")
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 454, in find_dir
    exclude))
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 437, in find_dir
    matches = self._exclude_dirs(matches)
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 498, in _exclude_dirs
    if not self._pass_filter(match, filter_):
  File "/usr/lib/python2.7/site-packages/certbot_apache/parser.py", line 521, in _pass_filter
    if expression.startswith("!"):
AttributeError: 'NoneType' object has no attribute 'startswith'
2019-01-18 15:13:41,155:ERROR:certbot.log:An unexpected error occurred:
I tried removing and reinstalling the certbot-apache pluging and reinstalling certbot itself. But none of this works. It seems to me that the object on line 521 is of type None and there can be no startwith (string) with that. But removing that particular if-statement is not solving it (and I don't think I should change py scripts myself). Anyone any idea what I could do or try? Thanks in advance!
Last edited by MuDeKi on 2019/01/22 09:34:00, edited 1 time in total.

MuDeKi
Posts: 7
Joined: 2018/02/21 15:05:55

Re: Certbot apache error: AttributeError: 'NoneType' object has no attribute 'startswith'

Post by MuDeKi » 2019/01/22 09:33:44

Oke, ik heb al mijn certificaten en configuratie weggehaald en daarna alles opnieuw aangevraagd en geconfigureerd en nu heb ik weer certificaten.

[Moderator: google translate says "Okay, I removed all my certificates and configuration and then re-requested and configured everything and now I have certificates again."]

Post Reply