Applicable to:
- Plesk for Linux
Symptoms
- The fail2ban service on the server fails to start and the
systemctl status fail2bancommand output is similar to the following:
# [root@server ~]# systemctl status fail2ban
● fail2ban.service - Fail2Ban Service
Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/fail2ban.service.d
└─50-ensure-log.conf
/etc/systemd/system/fail2ban.service.d
└─override.conf
Active: activating (auto-restart) (Result: exit-code) since Wed 2025-10-29 14:43:10 UTC; 1s ago
Docs: man:fail2ban(1)
Process: 1866826 ExecStart=/usr/bin/fail2ban-server -xf start (code=exited, status=1/FAILURE)
Process: 1866822 ExecStartPre=/bin/sh -c umask 077; touch /var/log/fail2ban.log; restorecon /var/log/fail2ban.log >/dev/null 2>&1 (code=exited, status=0/SUCCESS)
Process: 1866820 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS)
Main PID: 1866826 (code=exited, status=1/FAILURE) - Running the
journalctl -ufail2bancommand produces output that is similar to the following:CONFIG_TEXT: Oct 29 12:58:20 server.example.com systemd[1]: Started Fail2Ban Service.
Oct 29 12:58:20 server.example.com fail2ban-server[1783605]: Traceback (most recent call last):
Oct 29 12:58:20 server.example.com fail2ban-server[1783605]: File "/usr/bin/fail2ban-server", line 34, in <module>
Oct 29 12:58:20 server.example.com fail2ban-server[1783605]: from fail2ban.client.fail2banserver import exec_command_line, sys
Oct 29 12:58:20 server.example.com fail2ban-server[1783605]: ModuleNotFoundError: No module named 'fail2ban'
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Main process exited, code=exited, status=1/FAILURE
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Service RestartSec=100ms expired, scheduling restart.
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Scheduled restart job, restart counter is at 5.
Oct 29 12:58:20 server.example.com systemd[1]: Stopped Fail2Ban Service.
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Start request repeated too quickly.
Oct 29 12:58:20 server.example.com systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Oct 29 12:58:20 server.example.com systemd[1]: Failed to start Fail2Ban Service. -
Error that are similar to the following appear during an attempt to access Tools & Settings > IP Address Banning (Fail2Ban) > Banned IP Addresses menu:
PLESK_ERROR: Server Error
500 PleskUtilException
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
Type PleskUtilException
Message 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
File Agent.php
Line 159
Cause
The Fail2Ban component in Plesk can only work when /usr/bin/python3 leads to Python 3.6, however on this Linux server, /usr/bin/python3 is linked to Python 3.9 (or some other newer version) instead of Python 3.6:
# /usr/bin/python3 -V
Python 3.9.0
In general, what this shows is that /usr/bin/python3 on this server was most likely altered manually by the server's system administrator for a specific reason.
With that said, the general situation of a failed Fail2Ban service to which this leads is also considered a Plesk bug with ID PPPM-14555.
You may track the progress in relation to this bug in the Change Log for Plesk Obsidian
Note: please click the Follow button near the article headline to stay informed - you will receive an update via email when updates to the article are added
Resolution
Until the bug is resolved permanently, as a workaround, you may modify the Fail2Ban binary files in a way that would make them use Python 3.6 by following these steps:
-
Log into the server via SSH
-
Modify the first line of the
/usr/bin/fail2ban-clientand/usr/bin/fail2ban-serverfiles with your favorite command line text editor and change it from#!/usr/bin/python3to#!/usr/bin/python3.6 - Restart the
fail2banservice:
# systemctl restart fail2ban
Note: As an alternative to using command-line text editors, you may run the following commands in order to modify the mentioned files:
# sed -i '1s|^#!/usr/bin/python3|#!/usr/bin/python3.6|' /usr/bin/fail2ban-client
# sed -i '1s|^#!/usr/bin/python3|#!/usr/bin/python3.6|' /usr/bin/fail2ban-server
Comments
Please sign in to leave a comment.