Ubuntu升级后fail2ban无法开启

故障描述:

Ubuntu从14.0.2 update后,原来安装的fail2ban无法启动

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 Mon 2017-07-03 22:37:01 CST; 6ms ago Docs: man:fail2ban(1) Process: 3464 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255) 7月 03 22:37:01 tunnel systemd[1]: Failed to start Fail2Ban Service. 7月 03 22:37:01 tunnel systemd[1]: fail2ban.service: Unit entered failed state. 7月 03 22:37:01 tunnel systemd[1]: fail2ban.service: Failed with result 'exit-code'. dpkg: 处理软件包 fail2ban (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 1 正在处理用于 sgml-base (1.29) 的触发器 ... 正在处理用于 libc-bin (2.24-11+deb9u1) 的触发器 ... 正在处理用于 man-db (2.7.6.1-2) 的触发器 ... 正在处理用于 shared-mime-info (1.8-1) 的触发器 ... 在处理时有错误发生: fail2ban E: Sub-process /usr/bin/dpkg returned an error code (1)

处理过程:

查看应用日志:/var/log/fail2ban.log 没有相关信息

查看系统日志:/var/log/message 没有无法启动相关信息

重新启动看报错提示:/etc/init.d/fail2ban start

根据报错提示执行命令,看具体信息:

systemctl status fail2ban.service

journalctl -xe | tail -n 30 在这里有提示,说端口被占用,所有导致没有启动成功,原因定位在用户的配置文件上

ERROR  Failed during configuration: While reading from '/etc/fail2ban/jail.local' [line 119]: option 'port' in section 'pam-generic'already exists

这个是fail2ban在ubuntu下的一个bug,默认配置有端口冲突,需要更改

打开文件/etc/fail2ban/jail.local,找到[pam-generic]这个section,将port = anyport 注销掉(大概在147行),然后重新启动fail2ban即可

结论:

理论上升级不会导致配置变更,但本次遇到问题,应该是bug。问题原因是由于配置文件有误,导致端口占用而应用无法启动,需要修改默认端口再执行启动即可。

规避方法:

确认软件的配置文件是否正常配置

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,313评论 19 139
  • muahao阅读 2,161评论 0 3
  • systemd攻略 转自http://www.jianshu.com/p/d5305104d03a或者这个http...
    x1596357阅读 3,084评论 0 3
  • 最近在研究Docker的源码.读到ApiServer的启动过程时,发现其有一个新的概念,叫做service act...
    AlstonWilliams阅读 1,227评论 1 4
  • systemd攻略 相关文档 arch 的 systemd 说明页面 (简体中文) fedora 的 system...
    muahao阅读 11,914评论 0 12

友情链接更多精彩内容