Job for firewalld.service failed because a timeout was exceeded. See "systemctl status firewalld.ser

centos7.3输入所有有关 firewall-cmd 命令将会出现

Job for firewalld.service failed because a timeout was exceeded.See "systemctl status firewalld.service" and "journalctl -xe" for details.

的错误

原因:centos7 里面装了Python2.7  和 Python(其他) 两个版本,执行firewall-cmd 系列的命令的时候回运行Python文件结果Python文件的头 #!/usr/bin/python

都不会再python2.7 里面运行,

===================================

顺便说一句,出现ImportError: No module named ....这种错误的时候,

     第一检查出错的文件的头,是不是系统默认的Python,一般centos默认Python2.7,不是的话改成#!/usr/bin/python2.7。

     第二,用pip安装相应的模块

===================================

解决办法:

    1) 命令窗口输入

sudo 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: timeout) since Sat 2017-02-18 19:36:21 PST; 34min ago
Docs: man:firewalld(1)
Process: 9677 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUC
Main PID: 9677 (code=exited, status=0/SUCCESS)

Feb 18 19:34:49 Reksio systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 18 19:36:19 Reksio systemd[1]: firewalld.service: Start operation timed out. Terminating.
Feb 18 19:36:21 Reksio systemd[1]: Failed to start firewalld - dynamic firewall daemon.
Feb 18 19:36:21 Reksio systemd[1]: firewalld.service: Unit entered failed state.
Feb 18 19:36:21 Reksio systemd[1]: firewalld.service: Failed with result 'timeout'

    2) 再输入

sudo /usr/sbin/firewalld --nofork --nopid --debug 10

  即可找到 debug

  3)编辑: vim /usr/sbin/firewalld   将头改为 2.7 即可

  看下图

Job for firewalld.service failed because a timeout was exceeded. See "systemctl status firewalld.serJob for firewalld.service failed because a timeout was exceeded. See "systemctl status firewalld.ser


   成功解决!!!