Fail2ban service doesn't start: Error: Job for fail2ban.service failed because a timeout was exceeded.

Follow

Comments

9 comments

  • Avatar
    Markus Wernecke (Edited )

    Thank You very much for the right way. I got the same result like you have. But fail2ban.pid is missing. Directory /var/run/fail2ban/ is empty. Perhaps I misunderstood something, but I would like to know how to restore or create or get the missing fail2ban.pid.

    Would be great if You could tell me how to get it - to run fail2ban again after backup restoring/upgrade to Ubuntu18.

    Greets!

    0
    Comment actions Permalink
  • Avatar
    Pavel Rozental

    Hello Markus,

    The easiest way is to reinstall it from GUI Tools & Settings > Updates & Upgrades

    or command line like described here 

    # plesk installer remove --components fail2ban
    # plesk installer add --components fail2ban

     

    0
    Comment actions Permalink
  • Avatar
    Markus Wernecke (Edited )

    Hi Pavel. Thanks a lot for your help. It's necessary to do some additional work. I use dedicated Ubuntu 18.04.1 by 1und1 and Plesk 17.8.11 - Removing and installing alone was not successful. I got the following from Plesk Forum.

    • plesk installer remove --components fail2ban
    • aptitude purge fail2ban plesk-fail2ban-configurator
    • rm -rf /etc/fail2ban
    • rm -rf /etc/fail2ban.previous
    • plesk installer add --components fail2ban (not enough/successful)
    • However, only installing over Update/Upgrade panel brought the working fail2ban back.

     Like You wrote the only successful way was to re-install it over Updates/Upgrades panel.

    Great. THANKS a lot.

    1
    Comment actions Permalink
  • Avatar
    Tristan Huitenga

    Thanks for the tip. My /var/run/fail2ban folder was gone after every reboot on my Strato vps combined with Plesk. I added a cron job that recreated this folder at reboot:

    1. vi /var/spool/cron/crontabs/root

    2. Added this at the end of the file:

    @reboot mkdir -p /var/run/fail2ban ; chown pleskuser:pleskuser /var/run/fail2ban

    0
    Comment actions Permalink
  • Avatar
    Anthony Churchman (Edited )

    This all looked great for me and I had high hopes... until I got to the resolution.

    When I edit the fail2ban.conf file, the pidfile is exactly as you've stated but I still get the same error when trying to start the service. Had anyone else had this?

     

    Edit: I've resolved this now by commenting out the value "enabled = true" under the heading [sshd] in the file /etc/fail2ban/jail.d/defaults-debian.conf. I did this after running this command to see what the issue was: fail2ban-client -x start

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Anthone,

    Thank you for letting us know.

    Glad to hear it helped.

    0
    Comment actions Permalink
  • Avatar
    Miguel (Edited )

    Good Morning

    I have made the resolution but I have not been successful, I still have the timeout problem with Fail2ban and SpamAsassins, after updating yesterday they have not worked again.

    I have reinstalled them and they remain the same, restarted server and without success.

    Please help

     

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov

    @Miguel,

    You seems like faced systemd bug, please check for a solution here.

    0
    Comment actions Permalink
  • Avatar
    Miguel

    In the end, the solution has been to change VPS and company. The problem has been that we have updated the VPS but in the NODO no and after 3 days we could not wait any longer. Thanks Goddady :(

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request