Can't renew certificates : augeas.AugeasRuntimeError: Augeas.match() failed

Renewing certificates was working until now. Now I got this error:

An unexpected error occurred:
augeas.AugeasRuntimeError: Augeas.match() failed: /files/etc/apache2/sites-enabled/* [label()=~regexp('(?=(?P<g0>.*?\.conf))(?P=g0).*')]//*[self::directive=~regexp('([Ii][Nn][Cc][Ll][Uu][Dd][Ee])|([Ii][Nn][Cc][Ll][Uu][Dd][Ee])|([Ii][Nn][Cc][Ll][Uu][Dd][Ee][Oo][Pp][Tt][Ii][Oo][Nn][Aa][Ll])')]: Invalid path expression: invalid regular expression: Invalid preceding regular expression in /files/etc/apache2/sites-enabled/* [label()=~regexp('(?=(?P<g0>.*?\.conf))(?P=g0).*')]//*[self::directive=~regexp('([Ii][Nn][Cc][Ll][Uu][Dd][Ee])|([Ii][Nn][Cc][Ll][Uu][Dd][Ee])|([Ii][Nn][Cc][Ll][Uu][Dd][Ee][Oo][Pp][Tt][Ii][Oo][Nn][Aa][Ll])')]|=|

My domain is:

I ran this command:
certbot
It produced this output:

My web server is (include version):
Apache/2.4.62 (Ubuntu)
The operating system my web server runs on is (include version):
Ubuntu 22.04LTS
My hosting provider, if applicable, is:
None
I can login to a root shell on my machine (yes or no, or I don't know):
yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
No
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
certbot 3.0.1

What has changed? What's the problem?

Additional log from /var/log/letsencrypt/letsencrypt.log:

2024-12-23 10:46:35,322:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/opt/certbot/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/opt/certbot/lib/python3.10/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/main.py", line 1876, in main
    return config.func(config, plugins)
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/main.py", line 1397, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/selection.py", line 243, in choose_configurator_plugins
    configurator = pick_configurator(config, req_inst, plugins)
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/selection.py", line 27, in pick_configurator
    return pick_plugin(
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/selection.py", line 119, in pick_plugin
    filtered.prepare()
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/disco.py", line 248, in prepare
    return [plugin_ep.prepare() for plugin_ep in self._plugins.values()]
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/disco.py", line 248, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in self._plugins.values()]
  File "/opt/certbot/lib/python3.10/site-packages/certbot/_internal/plugins/disco.py", line 112, in prepare
    self._initialized.prepare()
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/configurator.py", line 376, in prepare
    self.parser = self.get_parser()
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/configurator.py", line 482, in get_parser
    return parser.ApacheParser(
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/parser.py", line 78, in __init__
    self.update_runtime_variables()
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/parser.py", line 294, in update_runtime_variables
    self.update_includes()
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/parser.py", line 307, in update_includes
    _ = self.find_dir("Include")
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/parser.py", line 565, in find_dir
    ordered_matches.extend(self.find_dir(
  File "/opt/certbot/lib/python3.10/site-packages/certbot_apache/_internal/parser.py", line 547, in find_dir
    matches = self.aug.match(
  File "/opt/certbot/lib/python3.10/site-packages/augeas/__init__.py", line 532, in match
    self._raise_error(AugeasRuntimeError,
  File "/opt/certbot/lib/python3.10/site-packages/augeas/__init__.py", line 154, in _raise_error

Thanks for your help.

Hi @kalon33,

How was Certbot install?

Edit

This is the recommended method Certbot Instructions | Certbot

Hi @Bruce5051, it has been installed using snap. I also tested using pip in a virtualenv, but I have the same error.

1 Like

Kindly wait for more knowledgeable community members to assist. :slightly_smiling_face:

That is very unusual error. Since it mentions this folder what does this show

ls -l /files/etc/apache2/sites-enabled/*

That is unusual path with just a standard Ubuntu Apache setup. Can you explain more about how Apache is installed and whether you made any changes recently.

2 Likes

Apache is installed through apt, and I didn't make any recent changes, that's why I'm pretty surprised... I haven't such a folder, my sites config files are in the standard /etc/apache2/sites-enabled/ folder. How does certbot infers this path?

1 Like

I have no idea. It has various default paths based on the O/S that it detects dynamically. That's all I know. Ubuntu 22 is incredibly common so surprised to see this. I even have a test server running that :slight_smile:

This may be a better post for the EFF's github for Certbot: Issues · certbot/certbot · GitHub

Or wait for a volunteer here with better understanding of Certbot internals.

Maybe @Osiris

Do you have an include in your Apache conf or possibly a .htaccess file that names that path?

1 Like

That's just how Augeas refers internally to the files.

@kalon33 Can you please show the conf file /etc/apache2/httpd.conf? I'm thinking it includes a line like:

Include /etc/apache2/sites-enabled/*

Not sure why Augeas is not liking that. It might somehow require a .conf extension, but I can't really tell.. The Certbot "augeas lens" at certbot/certbot-apache/certbot_apache/_internal/augeas_lens/httpd.aug at 314838eb81a39b1249fff23bc5e694c3e78094d1 · certbot/certbot · GitHub has not been modified the last 4 years.. So nothing new or changed there.

Could you try changing * to *.conf, if that's also how your configuration files in sites-enabled are called at least?

3 Likes

OK, I had:
IncludeOptional sites-enabled/*.conf*

that I replaced by:
IncludeOptional sites-enabled/*.conf

And that fixed my problem. Thanks for pointing me towards the solution!

Have a nice Christmas Eve!

3 Likes

The file was /etc/apache2/apache2.conf in Ubuntu 22.04LTS for the record.

Ah yes, I could see why Augeas wouldn't like that. Probably not something it recognises.

Do you mean you had a copy of apache2.conf in sites-enabled?

And named something different so that it was no longer picked up when changed to:

I believe you when those changes fixed things. Just for my own curiosity I am trying to understand exactly what went wrong. Thanks

1 Like

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