Can't renew cert (error in parsing the file)

I am trying to renew certificate, but for some reson letsencrypt script is failing with following message:

2017-07-23 20:48:29,268:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal   /confluence.domain.net.conf produced an unexpected error: The apache plugin is not working; there may be problems with your existing configuration.

The error was: PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’),). Skipping.

I haven’t changed anything, and it issued cert using that config earlier. Apache vhost config:

<IfModule mod_ssl.c>

<Virtualhost *:80>
ServerName confluence.domain.net
Redirect permanent / https://confluence.domain.net/
LogLevel warn
SetEnvIf Remote_Addr “::1” dontlog
CustomLog “/var/log/apache2/confluence.domain.net_custom.log” combined
ErrorLog “/var/log/apache2/confluence.domain.net_error.log”

<Virtualhost *:443>
ServerName confluence.domain.net
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/letsencrypt/live/confluence.domain.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/confluence.domain.net/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/confluence.domain.net/chain.pem

    Header always set Strict-Transport-Security "max-age=15768000"

    ProxyPass / http://localhost:8444/ connectiontimeout=5 timeout=300
    ProxyPassReverse        /  http://localhost:8444/
                                                                                                                                                                                            
    LogLevel warn                                                                                                                                                                           
    SetEnvIf Remote_Addr "::1" dontlog                                                                                                                                                      
    CustomLog "/var/log/apache2/confluence.domain.net_custom.log" combined                                                                                                            
    ErrorLog "/var/log/apache2/confluence.domain.net_error.log"                                                                                                                       

SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder on
SSLCompression off

SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:/var/run/ocsp(128000)

full error message in log:

2017-07-23 20:48:29,040:DEBUG:letsencrypt.cli:Root logging level set at 30

2017-07-23 20:48:29,041:INFO:letsencrypt.cli:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2017-07-23 20:48:29,041:DEBUG:letsencrypt.cli:letsencrypt version: 0.4.1
2017-07-23 20:48:29,042:DEBUG:letsencrypt.cli:Arguments: []
2017-07-23 20:48:29,042:DEBUG:letsencrypt.cli:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2017-07-23 20:48:29,049:DEBUG:letsencrypt.cli:Requested authenticator and installer
2017-07-23 20:48:29,049:DEBUG:letsencrypt.cli:Default Detector is Namespace(account=’’, agree_dev_preview=None, apache=’’, apache_challenge_location=’/etc/apache2’, apache_ctl=None, apache_dismod=‘a2dismod’, apache_enmod=‘a2enmod’, apache_handle_modules=True, apache_handle_sites=True, apache_init_script=None, apache_le_vhost_ext=’-le-ssl.conf’, apache_server_root=’/etc/apache2’, apache_vhost_root=’/etc/apache2/sites-available’, authenticator=’’, break_my_certs=’’, cert_path=’/etc/apache2/sites-enabled’, chain_path=None, checkpoints=0, config_dir=’’, config_file=None, configurator=’’, csr=’’, debug=’’, domains=[], dry_run=’’, duplicate=’’, email=’’, expand=’’, fullchain_path=None, func=<function renew at 0x7f7ff682f140>, hsts=False, http01_port=0, ifaces=’’, init=’’, installer=’’, key_path=’/etc/apache2/sites-enabled’, logs_dir=’’, manual=’’, manual_public_ip_logging_ok=False, manual_test_mode=False, nginx=’’, no_self_upgrade=’’, no_verify_ssl=False, noninteractive_mode=’’, os_packages_only=’’, prepare=’’, redirect=None, register_unsafely_without_email=’’, reinstall=’’, renew_by_default=’’, rsa_key_size=0, server=’’, staging=’’, standalone=’’, standalone_supported_challenges=‘tls-sni-01,http-01’, store_false_vars={’–no-uir’: True, <letsencrypt.cli.HelpfulArgumentParser object at 0x7f7ff9163210>: True, ‘–no-redirect’: True, ‘–no-hsts’: True}, strict_permissions=’’, text_mode=’’, tls_sni_01_port=0, tos=’’, uir=None, user_agent=None, verb=‘renew’, verbose_count=0, version=’’, webroot=’’, webroot_map={}, webroot_path=[], work_dir=’’)
2017-07-23 20:48:29,053:DEBUG:parsedatetime:parse (top of loop): [30 days][]
2017-07-23 20:48:29,058:DEBUG:parsedatetime:CRE_UNITS matched
2017-07-23 20:48:29,058:DEBUG:parsedatetime:parse (bottom) [][30 days][][]
2017-07-23 20:48:29,058:DEBUG:parsedatetime:weekday False, dateStd False, dateStr False, time False, timeStr False, meridian False
2017-07-23 20:48:29,058:DEBUG:parsedatetime:dayStr False, modifier False, modifier2 False, units True, qunits False
2017-07-23 20:48:29,058:DEBUG:parsedatetime:_evalString(30 days, time.struct_time(tm_year=2017, tm_mon=7, tm_mday=23, tm_hour=20, tm_min=48, tm_sec=29, tm_wday=6, tm_yday=204, tm_isdst=0))
2017-07-23 20:48:29,059:DEBUG:parsedatetime:_buildTime: [30 ][][days]
2017-07-23 20:48:29,059:DEBUG:parsedatetime:units days --> realunit days
2017-07-23 20:48:29,059:DEBUG:parsedatetime:return
2017-07-23 20:48:29,059:DEBUG:letsencrypt.storage:Should renew, less than 30 days before certificate expiry 2017-08-20 20:11:00 UTC.
2017-07-23 20:48:29,059:INFO:letsencrypt.cli:Cert is due for renewal, auto-renewing…
2017-07-23 20:48:29,059:DEBUG:letsencrypt.cli:Requested authenticator apache and installer apache
2017-07-23 20:48:29,266:DEBUG:letsencrypt.plugins.disco:Other error:(PluginEntryPoint#apache): (‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’)
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/letsencrypt/plugins/disco.py”, line 103, in prepare
self._initialized.prepare()
File “/usr/lib/python2.7/dist-packages/letsencrypt_apache/configurator.py”, line 174, in prepare
self.check_parsing_errors(“httpd.aug”)
File “/usr/lib/python2.7/dist-packages/letsencrypt_apache/augeas_configurator.py”, line 68, in check_parsing_errors
raise errors.PluginError(msg)
PluginError: (‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’)
2017-07-23 20:48:29,267:DEBUG:letsencrypt.display.ops:No candidate plugin
2017-07-23 20:48:29,267:DEBUG:letsencrypt.display.ops:No candidate plugin
2017-07-23 20:48:29,267:DEBUG:letsencrypt.cli:Selected authenticator None and installer None
2017-07-23 20:48:29,267:INFO:letsencrypt.cli:Could not choose appropriate plugin: The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’),)
2017-07-23 20:48:29,268:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal/confluence.domain.net.conf produced an unexpected error: The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’),). Skipping.
2017-07-23 20:48:29,269:DEBUG:letsencrypt.cli:Traceback was:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 1017, in renew
obtain_cert(lineage_config, plugins, renewal_candidate)
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 683, in obtain_cert
installer, authenticator = choose_configurator_plugins(config, plugins, “certonly”)
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 635, in choose_configurator_plugins
diagnose_configurator_problem(“authenticator”, req_auth, plugins)
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 536, in diagnose_configurator_problem
raise errors.PluginSelectionError(msg)
PluginSelectionError: The apache plugin is not working; there may be problems with your existing configuration.
The error was: PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-available/public.crt’, u’Syntax error’),)

2017-07-23 20:48:29,269:DEBUG:letsencrypt.cli:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/letsencrypt”, line 9, in
load_entry_point(‘letsencrypt==0.4.1’, ‘console_scripts’, ‘letsencrypt’)()
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 1986, in main
return config.func(config, plugins)
File “/usr/lib/python2.7/dist-packages/letsencrypt/cli.py”, line 1034, in renew
len(renew_failures), len(parse_failures)))
Error: 1 renew failure(s), 0 parse failure(s)

OK, I found the issue. There was one unnecessary file in sites-available directory (public.crt). Please delete / close topic.