Fail2Ban 0.9 on CentOS 7 error starting service

General support questions
Post Reply
zzserg
Posts: 7
Joined: 2014/11/26 10:03:12

Fail2Ban 0.9 on CentOS 7 error starting service

Post by zzserg » 2014/11/26 10:40:27

Hi, All!
Please help me solve strange problem...
Environment: CentOS Linux 7 (Core) x86_64, Fail2Ban v0.9.0 from repo EPEL 7, OwnCloud 7.0.3 from OwnCloud CentOS 7 repo.
I succesfull setup all environment and manually start fail2ban via command:

Code: Select all

fail2ban-client start
2014-11-26 13:14:05,884 fail2ban.server.server[26908]: INFO    Starting Fail2ban v0.9.0
2014-11-26 13:14:05,885 fail2ban.server.server[26908]: INFO    Starting in daemon mode
All working fine!

Than i suceccfully enabling fail2ban.service via:

Code: Select all

systemctl enable fail2ban.service
ln -s '/usr/lib/systemd/system/fail2ban.service' '/etc/systemd/system/multi-user.target.wants/fail2ban.service'
But when i try starting fail2ban.service i got error:

Code: Select all

systemctl start fail2ban.service
Job for fail2ban.service failed. See 'systemctl status fail2ban.service' and 'journalctl -xn' for details.
Result

Code: Select all

systemctl status fail2ban.service
fail2ban.service - Fail2ban Service
   Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled)
   Active: activating (start) since Ср 2014-11-26 13:16:25 MSK; 2s ago
 Main PID: 26844 (code=exited, status=255);         : 27043 (fail2ban-client)
   CGroup: /system.slice/fail2ban.service
           └─27043 /usr/bin/python /usr/bin/fail2ban-client -x start

Code: Select all

journalctl -xn
ноя 26 13:29:21 cloud.acconcept.ru systemd[1]: Starting Fail2ban Service...
-- Subject: Unit fail2ban.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has begun starting up.
ноя 26 13:29:23 cloud.acconcept.ru fail2ban-client[27566]: ERROR  No file(s) foun
d for glob /var/www/html/owncloud/data/owncloud.log
ноя 26 13:29:23 cloud.acconcept.ru fail2ban-client[27566]: ERROR  Failed during c
onfiguration: Have not found any log file for owncloud jail
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: fail2ban.service: control process
exited, code=exited status=255
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: Failed to start Fail2ban Service.
-- Subject: Unit fail2ban.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has failed.
--
-- The result is failed.
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: Unit fail2ban.service entered fail
ed state.
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: fail2ban.service holdoff time over
, scheduling restart.
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: Stopping Fail2ban Service...
-- Subject: Unit fail2ban.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has begun shutting down.
ноя 26 13:29:23 cloud.acconcept.ru systemd[1]: Starting Fail2ban Service...
-- Subject: Unit fail2ban.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has begun starting up.
Content of /usr/lib/systemd/system/fail2ban.service

Code: Select all

[Unit]
Description=Fail2ban Service
After=syslog.target network.target firewalld.service

[Service]
Type=forking
ExecStart=/usr/bin/fail2ban-client -x start
ExecStop=/usr/bin/fail2ban-client stop
ExecReload=/usr/bin/fail2ban-client reload
PIDFile=/var/run/fail2ban/fail2ban.pid
Restart=always

[Install]
WantedBy=multi-user.target
What wrong?

User avatar
TrevorH
Forum Moderator
Posts: 24097
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Fail2Ban 0.9 on CentOS 7 error starting service

Post by TrevorH » 2014/11/26 12:10:09

ноя 26 13:29:23 cloud.acconcept.ru fail2ban-client[27566]: ERROR No file(s) found for glob /var/www/html/owncloud/data/owncloud.log
Does it exist?
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

zzserg
Posts: 7
Joined: 2014/11/26 10:03:12

Re: Fail2Ban 0.9 on CentOS 7 error starting service

Post by zzserg » 2014/11/26 12:18:06

Yes, exist.
Manually runned fail2ban work fine.
Problem in systemd mode.

P.S.
Problem solved after disabling SeLinux.
I going to another thread - viewtopic.php?f=51&t=49827.

dongio
Posts: 47
Joined: 2011/08/15 09:34:36

Re: Fail2Ban 0.9 on CentOS 7 error starting service

Post by dongio » 2014/11/27 02:24:26

Here it doesn't start too, but Selinux is already disabled

Code: Select all

fail2ban.service - Fail2ban Service
   Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled)
   Active: failed (Result: start-limit) since Thu 2014-11-27 03:16:46 CET; 8s ago
  Process: 32591 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)

Nov 27 03:16:46 myhostname systemd[1]: Failed to start Fail2ban Service.
Nov 27 03:16:46 myhostname systemd[1]: Unit fail2ban.service entered failed state.
Nov 27 03:16:46 myhostname systemd[1]: fail2ban.service holdoff time over, scheduling restart.
Nov 27 03:16:46 myhostname systemd[1]: Stopping Fail2ban Service...
Nov 27 03:16:46 myhostname systemd[1]: Starting Fail2ban Service...
Nov 27 03:16:46 myhostname systemd[1]: fail2ban.service start request repeated too quickly, refusing to start.
Nov 27 03:16:46 myhostname systemd[1]: Failed to start Fail2ban Service.
Nov 27 03:16:46 myhostname systemd[1]: Unit fail2ban.service entered failed state.

Code: Select all

-- Logs begin at Wed 2014-11-26 04:20:23 CET, end at Thu 2014-11-27 03:19:40 CET. --
Nov 27 03:19:39 myhostname systemd[1]: Failed to start Fail2ban Service.
-- Subject: Unit fail2ban.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has failed.
--
-- The result is failed.
Nov 27 03:19:39 myhostname systemd[1]: Unit fail2ban.service entered failed state.
Nov 27 03:19:40 myhostname systemd[1]: fail2ban.service holdoff time over, scheduling restart.
Nov 27 03:19:40 myhostname systemd[1]: Stopping Fail2ban Service...
-- Subject: Unit fail2ban.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has begun shutting down.
Nov 27 03:19:40 myhostname systemd[1]: Starting Fail2ban Service...
-- Subject: Unit fail2ban.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has begun starting up.
Nov 27 03:19:40 myhostname fail2ban-client[691]: ERROR  [b]No file(s) found for glob /var/log/nginx/access.log[/b]
Nov 27 03:19:40 myhostname fail2ban-client[691]: ERROR  Failed during configuration: [b]Have not found any log file for php-url-fopen jail[/b]
Nov 27 03:19:40 myhostname systemd[1]: fail2ban.service: control process exited, code=exited status=255
Nov 27 03:19:40 myhostname systemd[1]: Failed to start Fail2ban Service.
-- Subject: Unit fail2ban.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fail2ban.service has failed.
--
-- The result is failed.
Nov 27 03:19:40 myhostname systemd[1]: Unit fail2ban.service entered failed state.
I'm not using nginx, so i have to delete that line %(nginx_access_log)s from logpath = %(nginx_access_log)s %(apache_access_log)s in [php-url-fopen] ?
but why they put those together? :D to never let it starting @ default config?

kbroughton
Posts: 2
Joined: 2016/03/10 16:53:38

Re: Fail2Ban 0.9 on CentOS 7 error starting service

Post by kbroughton » 2016/06/06 22:11:57

In my case it was fail2ban 1.5.0 on centos7 on aws
I had a cluster of 7 nodes and on 2, cloud-init and fail2ban failed to start on a reboot.
systemctl start cloud-init worked fine.
systemctl start fail2ban gave the "repeated too quickly" error above.

running
```
/usr/bin/fail2ban-client -x start
```
gave the useful error
```
ERROR There is no directory /var/run/fail2ban to contain the socket file /var/run/fail2ban/fail2ban.sock.
```
mkdir /var/run/fail2ban and systemctl restart then worked

SilverArrow
Posts: 6
Joined: 2014/05/01 13:41:15

Re: Fail2Ban 0.9 on CentOS 7 error starting service

Post by SilverArrow » 2017/03/22 20:05:18

Thanks kbroughton, I had the same problem on Fedora 25 with the latest updates. Your solution fixed it.

Post Reply