Plesk provides error in Tools & Settings > IP Addresses Banning (Fail2Ban) > Ban

Started by senthil, Jun 04, 2025, 03:25 AM

Previous topic - Next topic

senthil

Symptoms
  • Error like below appears during an attempt to access Tools & Settings > IP Address Banning (Fail2Ban) > Banned
    IP Addresses
    menu:
    f2bmng failed: Traceback (most recent call last): File "/usr/bin/fail2ban-client", line 34, in
    <module> from fail2ban.client.fail2banclient import exec_command_line, sys
    ModuleNotFoundError: No module named 'fail2ban' ERROR:__main__:Command
    '['/usr/bin/fail2ban-client', '--str2sec', '1w']' returned non-zero exit status 1.
    ERROR:__main__:Not a time string: 1w
  • Server uses Python 3.9 (or some other version):
    #/usr/bin/python3 -V
    Python 3.9.0
Cause
Fail2Ban component requires Python 3.6 version, but the server invokes another Python version. Such behavior is
considered as a bug with ID PPPM-14555.

Resolution
Workaround: modify the Fail2Ban files, so it would use Python 3.6

  • Log into server via SSH.
  • Modify the first line of the /usr/bin/fail2ban-client file using one of the following methods:
  • Open file using vi (or some other editor), and specify Python 3.6 on the first line:
    #!/usr/bin/python3.6
Or
  • Run the following command to modify the file:
    #sed -i '1s|^#!/usr/bin/python3|#!/usr/libexec/platform-python3.6|'
    /usr/bin/fail2ban-client