Score:2

fail2ban wont start/Python syntax error

ir flag

I installed fail2ban on my Ubuntu 18.04 server. But when i try to start the service i get this error.

fail2ban.service: Start request repeated too quickly. fail2ban.service: Failed with result 'exit-code'. Failed to start Fail2Ban Service.

When i run the client as a user on another post suggested i get a Python syntax error:

> fail2ban-client -start
Traceback (most recent call last):
  File "/usr/bin/fail2ban-client", line 34, in <module>
    from fail2ban.client.fail2banclient import exec_command_line, sys
  File "/usr/lib/python3/dist-packages/fail2ban/client/fail2banclient.py", line 231
    def configureServer(self, async=True, phase=None):
                              ^
SyntaxError: invalid syntax

How can i fix this. I couldn't find any other info online regarding this issue.

Thanks!

Score:4
cz flag

This is a bug in fail2ban which affects Ubuntu 18.04 LTS (and 18.10 but that's EOL already). For unknown reasons the relevant Ubuntu package maintainers have chosen not to fix this bug, even though a patch is available. You can try to patch the code yourself, or post on launchpad asking why it hasn't been fixed, or upgrade to 20.04 LTS.

cn flag
It worked! Thanks.
Score:0
my flag

I know it's been a while, but I had the same problem today.

I solved it by installing the latest version of fail2ban as a deb package from the fail2ban Github repo.

At the time of writing, I used wget to get this package:

wget https://github.com/fail2ban/fail2ban/releases/download/0.11.2/fail2ban_0.11.2-1.upstream1_all.deb

and installed the package with apt-get install -f ./fail2ban_0.11.2-1.upstream1_all.deb

After that, I was able to start the fail2ban service and it works perfectly.

in flag
Downside of this approach is that you won't receive updates for the package anymore.
hgaronfolo avatar
my flag
Yeah you are right. But I guess I won’t anyway until I upgrade to a more recent LTS release. I think the best approach is to always be on a non-outdated LTS release.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.