Unable to manage fail2ban: ImportError: No module named optmatch

Created:

2016-12-12 03:39:59 UTC

Modified:

2017-08-08 13:30:09 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to manage fail2ban: ImportError: No module named optmatch

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

  • Unable to manage Fail2ban
  • Reinstalling of fail2ban packages (manually or by plesk installer ) will produce following errors:
    (1/2): fail2ban-0.9.2-centos6.15103017.noarch.rpm        | 412 kB     00:00
    (2/2): plesk-fail2ban-configurator-12.5.30-cos6.build120 | 182 kB 00:00
    Running rpm_check_debug
    Installing: 1:fail2ban-0.9.2-centos6.15103017.noarch [1/2]
    Installing: plesk-fail2ban-configurator-12.5.30-cos6.build1205150901.17.noarch [2/2]
    Verify: 1/2: fail2ban.noarch 1:0.9.2-centos6.15103017 - u
    Verify: 2/2: plesk-fail2ban-configurator.noarch 0:12.5.30-cos6.build1205150901.17 - u
    Traceback (most recent call last):
    File "/usr/local/psa/admin/sbin/f2bmng", line 5, in <module>
    import f2bmng
    File "/usr/local/psa/lib/modules/python/f2bmng/f2bmng.py", line 18, in <module>
    from optmatch import OptionMatcher, optmatcher, UsageException
    ImportError: No module named optmatch
    Traceback (most recent call last):
    File "/usr/local/psa/admin/sbin/f2bmng", line 5, in <module>
    import f2bmng
    File "/usr/local/psa/lib/modules/python/f2bmng/f2bmng.py", line 18, in <module>
    from optmatch import OptionMatcher, optmatcher, UsageException
    ImportError: No module named optmatch

Cause

Python module optmatch is missing. Python libraries were not installed properly.

Resolution

  • Uninstall package psa-pylibplesk manually.

During uninstalling warning message about missing files and directories can occur.

    # rpm -e --nodeps psa-pylibplesk-12.5.30-cos6.build1205150826.19.x86_64.rpm

warning: erase unlink of /usr/local/psa/admin/lib/python/plesk_subprocess.py failed: No such file or directory
warning: erase unlink of /usr/local/psa/admin/lib/python/plesk_service.py failed: No such file or directory
warning: erase unlink of /usr/local/psa/admin/lib/python/plesk_log.py failed: No such file or directory
...
warning: erase unlink of /usr/local/psa/admin/lib/python/optmatch/__init__.py failed: No such file or directory
warning: erase unlink of /usr/local/psa/admin/lib/python/optmatch failed: No such file or directory
warning: erase unlink of /usr/local/psa/admin/lib/python/compat/textwrap.py failed: No such file or directory
warning: erase unlink of /usr/local/psa/admin/lib/python/compat/optparse.py failed: No such file or directory
  • Download psa-pylibplesk from Plesk Repository for needed OS in base directory. Replace the name of the package in below steps.

    # wget http://autoinstall.plesk.com/PSA_12.5.30/dist-rpm-CentOS-6-x86_64/base/psa-pylibplesk-12.5.30-cos6.build1205150826.19.x86_64.rpm
  • Install downloaded package without dependencies:

    # rpm -Uvh psa-pylibplesk-12.5.30-cos6.build1205150826.19.x86_64.rpm --nodeps --force
  • Check that directory /usr/local/psa/admin/lib/python/optmatch exist and contain appropriate files:

    # ls -la /usr/local/psa/admin/lib/python/optmatch

    -rw-r--r-- 1 root root 54901 Aug 26 2015 __init__.py
    -rw-r--r-- 1 root root 46745 Oct 25 00:34 __init__.pyc
    -rw-r--r-- 1 root root 46745 Oct 25 00:34 __init__.pyo
  • Run plesk install to install fail2ban:

    # plesk installer
Have more questions? Submit a request
Please sign in to leave a comment.