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.

Kevin Bowen
  • 19,395
  • 55
  • 76
  • 81
NerdOfCode
  • 2,408
  • 4
  • 16
  • 33

2 Answers2

12

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.

Duncanmoo
  • 2,310
  • 1
  • 15
  • 15
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.

iMitwe
  • 123
  • 8