Python error when registering new apache domain

I am unable to register my domain when running certbot --apache.

My domain is: dcaudio.dk

I ran this command: sudo certbot --apache -d dcaudio.dk -d www.dcaudio.dk

It produced this output:

2022-02-13 11:03:40,149:ERROR:certbot.log:An unexpected error occurred: 2022-02-13 11:03:53,415:DEBUG:certbot.main:certbot version: 0.31.0 2022-02-13 11:03:53,416:DEBUG:certbot.main:Arguments: ['--apache', '-d', 'dcaudio.dk', '-d', 'www.dcaudio.dk'] 2022-02-13 11:03:53,417:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot) 2022-02-13 11:03:53,459:DEBUG:certbot.log:Root logging level set at 20 2022-02-13 11:03:53,461:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log 2022-02-13 11:03:53,463:DEBUG:certbot.plugins.selection:Requested authenticator apache and installer apache 2022-02-13 11:03:53,497:DEBUG:certbot.log:Exiting abnormally: Traceback (most recent call last): File "/usr/bin/certbot", line 11, in <module> load_entry_point('certbot==0.31.0', 'console_scripts', 'certbot')() File "/usr/lib/python3/dist-packages/certbot/main.py", line 1365, in main return config.func(config, plugins) File "/usr/lib/python3/dist-packages/certbot/main.py", line 1101, in run installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run") File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 225, in choose_configurator_plugins authenticator = installer = pick_configurator(config, req_inst, plugins) File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 25, in pick_configurator (interfaces.IAuthenticator, interfaces.IInstaller)) File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 106, in pick_plugin verified.prepare() File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in prepare return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)] File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in <listcomp> return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)] File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 132, in prepare self._initialized.prepare() File "/usr/lib/python3/dist-packages/certbot_apache/configurator.py", line 225, in prepare self.init_augeas() File "/usr/lib/python3/dist-packages/certbot_apache/augeas_configurator.py", line 51, in init_augeas self.recovery_routine() File "/usr/lib/python3/dist-packages/certbot_apache/augeas_configurator.py", line 184, in recovery_routine super(AugeasConfigurator, self).recovery_routine() File "/usr/lib/python3/dist-packages/certbot/plugins/common.py", line 163, in recovery_routine self.reverter.recovery_routine() File "/usr/lib/python3/dist-packages/certbot/reverter.py", line 460, in recovery_routine self._recover_checkpoint(self.config.in_progress_dir) File "/usr/lib/python3/dist-packages/certbot/reverter.py", line 295, in _recover_checkpoint os.path.basename(path) + "_" + str(idx)), path) File "/usr/lib/python3.7/shutil.py", line 261, in copy2 if os.path.isdir(dst): File "/usr/lib/python3.7/genericpath.py", line 42, in isdir st = os.stat(s) ValueError: embedded null byte 2022-02-13 11:03:53,507:ERROR:certbot.log:An unexpected error occurred:

My web server is (include version): Apache/2.4.38

The operating system my web server runs on is (include version): Raspbian GNU/Linux 10 (buster)

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 0.31.0

That's really old. How did you install it?

You should use snap or pip, not the apt package that comes with Debian 10. (Or another acme client)

1 Like

Okay. I had previsouly installed using sudo apt install python3-certbot-apache. I have tried again installing with snap and now have certbot 1.23.0 but see a different python error:

2022-02-13 14:00:47,551:DEBUG:urllib3.connectionpool:http://localhost:None "GET /v2/connections?snap=certbot&interface=content HTTP/1.1" 200 97
2022-02-13 14:00:49,811:DEBUG:certbot._internal.main:certbot version: 1.23.0
2022-02-13 14:00:49,812:DEBUG:certbot._internal.main:Location of certbot entry point: /snap/certbot/1787/bin/certbot
2022-02-13 14:00:49,812:DEBUG:certbot._internal.main:Arguments: ['--apache', '-d', 'dcaudio.dk', '-v', '--preconfigured-renewal']
2022-02-13 14:00:49,813:DEBUG:certbot._internal.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2022-02-13 14:00:49,860:DEBUG:certbot._internal.log:Root logging level set at 20
2022-02-13 14:00:49,867:DEBUG:certbot._internal.plugins.selection:Requested authenticator apache and installer apache
2022-02-13 14:00:50,125:DEBUG:certbot_apache._internal.configurator:Apache version is 2.4.38
2022-02-13 14:00:50,128:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/snap/certbot/1787/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/main.py", line 1683, in main
    return config.func(config, plugins)
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/main.py", line 1371, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 244, in choose_configurator_plugins
    configurator = pick_configurator(config, req_inst, plugins)
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 27, in pick_configurator
    return pick_plugin(
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 120, in pick_plugin
    verified.prepare()
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 309, in prepare
    return [plugin_ep.prepare() for plugin_ep in self._plugins.values()]
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 309, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in self._plugins.values()]
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 160, in prepare
    self._initialized.prepare()
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot_apache/_internal/configurator.py", line 366, in prepare
    self.recovery_routine()
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot_apache/_internal/configurator.py", line 436, in recovery_routine
    super().recovery_routine()
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/plugins/common.py", line 196, in recovery_routine
    self.reverter.recovery_routine()
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/reverter.py", line 401, in recovery_routine
    self._recover_checkpoint(self.config.in_progress_dir)
  File "/snap/certbot/1787/lib/python3.8/site-packages/certbot/reverter.py", line 238, in _recover_checkpoint
    shutil.copy2(os.path.join(
  File "/snap/certbot/1787/usr/lib/python3.8/shutil.py", line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/snap/certbot/1787/usr/lib/python3.8/shutil.py", line 243, in copyfile
    if _samefile(src, dst):
  File "/snap/certbot/1787/usr/lib/python3.8/shutil.py", line 220, in _samefile
    return os.path.samefile(src, dst)
  File "/snap/certbot/1787/bin/../usr/lib/python3.8/genericpath.py", line 100, in samefile
    s1 = os.stat(f1)
ValueError: embedded null byte
2022-02-13 14:00:50,137:ERROR:certbot._internal.log:An unexpected error occurred:
2022-02-13 14:00:50,139:ERROR:certbot._internal.log:ValueError: embedded null byte

It's the same error. I think somewhere in your Apache directory there's a malformed filename or directory, which contains a null byte.

2 Likes

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