更改python版本导致centos 7防火墙启动失败

原创
2017/04/25 10:47
阅读数 3.8K

一大早跑个docker玩玩,很开心的从本地访问服务器上的nginx服务,感觉哪里不对劲,想想我的服务器开了防火墙,而nginx映射对口我并没有加入防火墙,居然能访问,起了疑心就去看个究竟,一看发现systemctl status firewalld.service命令居然无效,报的错误是

Unit firewalld.service could not be found

难道是防火墙被卸载了,由于最近刚刚安装了docker,怀疑是不是这个原因,于是yum install firewalld,

执行systemctl start irewalld.service,报了另一个错误:

Job for firewalld.service failed because the control process exited with error code. 
See "systemctl status firewalld.service" and "journalctl -xe" for details.

根据提示执行systemctl status firewalld.service和journalctl -xe,看了半天没弄明白,

systemctl status firewalld.service执行结果 :

firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2017-04-25 10:15:51 CST; 2min 4s ago
     Docs: man:firewalld(1)
  Process: 3698 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=1/FAILURE)
 Main PID: 3698 (code=exited, status=1/FAILURE)

Apr 25 10:15:51 test systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 25 10:15:51 test systemd[1]: firewalld.service: main process exited, code=exited, status=1/FAILURE
Apr 25 10:15:51 test systemd[1]: Failed to start firewalld - dynamic firewall daemon.
Apr 25 10:15:51 test systemd[1]: Unit firewalld.service entered failed state.
Apr 25 10:15:51 test systemd[1]: firewalld.service failed.

另一个执行结果也贴一段:

Apr 25 10:10:22 test systemd[1]: Unit firewalld.service entered failed state.
Apr 25 10:10:22 test systemd[1]: firewalld.service failed.
Apr 25 10:10:22 test polkitd[27822]: Unregistered Authentication Agent for unix-process:3582:1647230929 (system bus name :1.6509, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Apr 25 10:13:57 test polkitd[27822]: Registered Authentication Agent for unix-process:3617:1647252460 (system bus name :1.6510 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UT
Apr 25 10:13:57 test polkitd[27822]: Unregistered Authentication Agent for unix-process:3617:1647252460 (system bus name :1.6510, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Apr 25 10:15:12 test yum[3642]: Erased: firewalld-0.4.3.2-8.1.el7_3.2.noarch
Apr 25 10:15:12 test dbus[9212]: [system] Reloaded configuration
Apr 25 10:15:12 test systemd[1]: Reloading.
Apr 25 10:15:12 test systemd[1]: Configuration file /usr/lib/systemd/system/ebtables.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Apr 25 10:15:24 test polkitd[27822]: Registered Authentication Agent for unix-process:3665:1647261079 (system bus name :1.6511 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UT
Apr 25 10:15:24 test polkitd[27822]: Unregistered Authentication Agent for unix-process:3665:1647261079 (system bus name :1.6511, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Apr 25 10:15:42 test dbus[9212]: [system] Reloaded configuration
Apr 25 10:15:42 test dbus[9212]: [system] Reloaded configuration
Apr 25 10:15:42 test systemd[1]: Reloading.
Apr 25 10:15:42 test systemd[1]: Configuration file /usr/lib/systemd/system/ebtables.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Apr 25 10:15:42 test yum[3673]: Installed: firewalld-0.4.3.2-8.1.el7_3.2.noarch
Apr 25 10:15:51 test polkitd[27822]: Registered Authentication Agent for unix-process:3692:1647263798 (system bus name :1.6512 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UT
Apr 25 10:15:51 test systemd[1]: Starting firewalld - dynamic firewall daemon...
-- Subject: Unit firewalld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit firewalld.service has begun starting up.
Apr 25 10:15:51 test systemd[1]: firewalld.service: main process exited, code=exited, status=1/FAILURE
Apr 25 10:15:51 test systemd[1]: Failed to start firewalld - dynamic firewall daemon.
-- Subject: Unit firewalld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit firewalld.service has failed.
-- 
-- The result is failed.
Apr 25 10:15:51 test systemd[1]: Unit firewalld.service entered failed state.
Apr 25 10:15:51 test systemd[1]: firewalld.service failed.
Apr 25 10:15:51 test polkitd[27822]: Unregistered Authentication Agent for unix-process:3692:1647263798 (system bus name :1.6512, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)

反正还是不怎么明白,就去看看防火墙正常的服务器,看下:

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-01-04 09:57:11 CST; 3 months 19 days ago
 Main PID: 9897 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─9897 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 04 09:57:11 test1 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 04 09:57:11 test1 systemd[1]: Started firewalld - dynamic firewall daemon.

发现了这个,/usr/bin/python,想起前几天改过python版本,目录重命名了,再看下/usr/sbin/firewalld,是python脚本,且路径执行/usr/bin/python,改了下/usr/bin/python2 新目录,执行防火墙启动命令下,成功了。

总结:python环境的更改会导致python脚本写的服务器程序无法执行,以后要慎重修改python环境

展开阅读全文
打赏
0
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部