0

I am trying to install fail2ban service on my ubuntu server 16.04, but i have this error and fail2ban service cannot start, what's the problem?

root@clm:~# apt install fail2ban
Reading package lists... Done
Building dependency tree       
Reading state information... Done
fail2ban is already the newest version (0.9.3-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up fail2ban (0.9.3-1) ...
Job for fail2ban.service failed because the control process exited with error code. See "systemctl status fail2ban.service" and "journalctl -xe" for details.
invoke-rc.d: initscript fail2ban, action "start" failed.
● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2017-12-29 18:08:01 CET; 8ms ago
     Docs: man:fail2ban(1)
  Process: 4888 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)

Dec 29 18:08:01 domain systemd[1]: Failed to start Fail2Ban Service.
Dec 29 18:08:01 domain systemd[1]: fail2ban.service: Unit entered failed state.
Dec 29 18:08:01 domain systemd[1]: fail2ban.service: Failed with result 'exit-code'.
dpkg: error processing package fail2ban (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 fail2ban
E: Sub-process /usr/bin/dpkg returned an error code (1)

The log say it's just like this,

root@clm:~# systemctl status fail2ban.service
● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Fri 2017-12-29 18:27:09 CET; 9min ago
     Docs: man:fail2ban(1)
  Process: 7277 ExecStop=/usr/bin/fail2ban-client stop (code=exited, status=0/SUCCESS)
  Process: 7301 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)
 Main PID: 7026 (code=killed, signal=TERM)

Dec 29 18:27:09 domain systemd[1]: fail2ban.service: Control process exited, code=exited status=255
Dec 29 18:27:09 domain systemd[1]: Failed to start Fail2Ban Service.
Dec 29 18:27:09 domain systemd[1]: fail2ban.service: Unit entered failed state.
Dec 29 18:27:09 domain systemd[1]: fail2ban.service: Failed with result 'exit-code'.
Dec 29 18:27:09 domain systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
Dec 29 18:27:09 domain systemd[1]: Stopped Fail2Ban Service.
Dec 29 18:27:09 domain systemd[1]: fail2ban.service: Start request repeated too quickly.
Dec 29 18:27:09 domain systemd[1]: Failed to start Fail2Ban Service.
root@clm:~# tail -f /var/log/fail2ban.log 
2017-12-29 18:26:08,198 fail2ban.actions        [7026]: INFO    Set banTime = 600
2017-12-29 18:26:08,262 fail2ban.filter         [7026]: INFO    Added logfile = /var/log/auth.log
2017-12-29 18:26:08,330 fail2ban.filter         [7026]: INFO    Set jail log file encoding to UTF-8
2017-12-29 18:26:08,331 fail2ban.filter         [7026]: INFO    Set maxRetry = 5
2017-12-29 18:26:08,331 fail2ban.filter         [7026]: INFO    Set maxlines = 10
2017-12-29 18:26:08,448 fail2ban.server         [7026]: INFO    Jail sshd is not a JournalFilter instance
2017-12-29 18:26:08,465 fail2ban.jail           [7026]: INFO    Jail 'sshd' started
2017-12-29 18:27:05,924 fail2ban.server         [7026]: INFO    Stopping all jails
2017-12-29 18:27:06,756 fail2ban.jail           [7026]: INFO    Jail 'sshd' stopped
2017-12-29 18:27:06,831 fail2ban.server         [7026]: INFO    Exiting Fail2ban
  • What do the logs say? As written in the message: See "systemctl status fail2ban.service" and "journalctl -xe" for details. – Patrick Mevzek Dec 29 '17 at 17:25
2

My guess is that there's a problem in the configuration file. try running

fail2ban-server  -f -x

and see what happens

  • that command it just give me 2017-12-29 18:54:56,420 fail2ban.server [7680]: INFO Starting Fail2ban v0.9.3 ...., that's right, the problem is come from configuration, thank you – ensabahn Dec 29 '17 at 17:56
1

Okay, this is the problem,

After i check with journalctl -xe, i found a (maybe wrong configuration / this is a bug), this the log:

Dec 29 18:46:27 *domain* fail2ban-client[7530]: ERROR  Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 99]: option 'port' in section 'pam-generic'

so i give try to give a comment on line 99 like the log say, and it's working right now, whereas before, i try to implement on ubuntu 14.04 is working well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.