• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

fail2ban does not start: Unable to remove PID file

Tommy10

Basic Pleskian
I am not able to start fail2ban anymore. It always crashes while it starts.

Error:
Code:
Unable to remove PID file: [Errno 2] No such file or directory: '/var/run/fail2ban/fail2ban.pid'

The directory /var/run/fail2ban/ exists. The PID file does not exist. If I create it it will be deleted but the error still occurs. This is crazy.

I also tried to reinstall fail2ban over the Plesk Installer - the issue still occurs.

My system: Debian 8.4, Plesk 12.5.30 Update #32


$ ls -al /var/run/fail2ban/
Code:
total 0
drwxr-x---  2 root root  40 May 23 02:59 .
drwxr-xr-x 26 root root 1080 May 23 02:25 ..

/var/log/fail2ban.log
Code:
2016-05-23 02:41:59,874 fail2ban.server  [24474]: DEBUG  Caught signal 15. Exiting
2016-05-23 02:41:59,874 fail2ban.asyncserver  [24474]: DEBUG  Removed socket file /var/run/fail2ban/fail2ban.sock
2016-05-23 02:41:59,874 fail2ban.asyncserver  [24474]: DEBUG  Socket shutdown
2016-05-23 02:41:59,874 fail2ban.server  [24474]: INFO  Stopping all jails
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-apache-badbot
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-roundcube
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-panel
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-apache
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-dovecot
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail ssh
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-postfix
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-horde
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-proftpd
2016-05-23 02:41:59,875 fail2ban.server  [24474]: DEBUG  Stopping jail plesk-wordpress
2016-05-23 02:41:59,876 fail2ban.datedetector  [24474]: DEBUG  Sorting the template list
2016-05-23 02:41:59,876 fail2ban.datedetector  [24474]: DEBUG  Winning template: (?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)? with 0 hits
2016-05-23 02:41:59,876 fail2ban.server  [24474]: DEBUG  Remove PID file /var/run/fail2ban/fail2ban.pid
2016-05-23 02:41:59,876 fail2ban.server  [24474]: ERROR  Unable to remove PID file: [Errno 2] No such file or directory: '/var/run/fail2ban/fail2ban.pid'
2016-05-23 02:41:59,876 fail2ban.server  [24474]: INFO  Exiting Fail2ban
 
I have fixed it the hard way:
$ apt-get purge fail2ban

You need to run "purge" to fully delete all configuration files of `fail2ban`. The Plesk Installer will only remove the `fail2ban` application and not it's configuration files.

Warning: Your fail2ban configurations will be lost.
 
I used this

https://kb.plesk.com/en/122407

with same errors as above, for me the solution was to disable all apache-badbot jails created wit the hipelink guide and got started fail2ban with no problem, later little by little, (in six times), enabled the apache-badbot jails again.

Now i can make modifications in fail2ban configuration and is working so fine apache-badbot, apache, courier-imap and postfix jails enabled
 
Back
Top