5

Recently, I have tried restarting Fail2ban and I have received an error, making it impossible to start... The full error I received from systemctl status fail2ban is as follows:

Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Jan 03 18:27:02 nerdofcode.com systemd[1]: Failed to start Fail2Ban Service.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Unit entered failed state.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Jan 03 18:27:02 nerdofcode.com systemd[1]: Stopped Fail2Ban Service.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Start request repeated too quickly.
Jan 03 18:27:02 nerdofcode.com systemd[1]: Failed to start Fail2Ban Service.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Unit entered failed state.
Jan 03 18:27:02 nerdofcode.com systemd[1]: fail2ban.service: Failed with result 'exit-code'.

The full output of cat /var/log/fail2ban.log is:

2018-01-03 18:06:28,337 fail2ban.server         [25119]: INFO    
Exiting Fail2ban

I would appreciate any suggestions or solutions towards this issue.

6
  • is that error line from /var/log/fail2ban.log?
    – bistoco
    Jan 4, 2018 at 0:27
  • The error is provided from systemctl status fail2ban
    – NerdOfCode
    Jan 4, 2018 at 0:30
  • 2
    Then check /var/log/fail2ban.log. Hopefully it will give you a detailed trace of the reason of failure.
    – bistoco
    Jan 4, 2018 at 0:33
  • This may help
    – bistoco
    Jan 4, 2018 at 0:38
  • 1
    That's not a solution, it will help you to identify errors on your config, so you can fix them and then restart the service properly.
    – bistoco
    Jan 4, 2018 at 0:43

2 Answers 2

14

There is a good chance that the error has been logged to /var/log/fail2ban.log however you can also see what the problem is by running fail2ban-client -x start and you will get something descriptive.

In my case it was an exim rejectlog that did not yet exist.

Credit to @bistoco's comment on the question.

1
  • 2
    fail2ban-client -x start is very helpful! In my case there was nothing in /var/log/fail2ban.log Aug 6, 2022 at 14:48
0

The error was not logged in /var/log/fail2ban.log as suggested elsewhere. You better stop beforehand the fail2ban process. On systemd you do a :

sudo /usr/bin/fail2ban-client stop

For my case it wasn't even running so after that I manually started fail2ban and it finally gave me the error:

$ sudo /usr/bin/fail2ban-client stop
RROR  Failed to access socket path: /var/run/fail2ban/fail2ban.sock. Is fail2ban running?
$ sudo /usr/bin/fail2ban-client -x start
ERROR  No file(s) found for glob /var/log/apache2/*error.log
ERROR  Failed during configuration: Have not found any log file for apache-shellshock jail

I went on a corrected the apache-shellshock instructions in /etc/fail2ban/jail.local and restarted fail2ban and it worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .