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

lm_y發表於2017-09-20

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 即可

  看下圖



   成功解決!!!


相關文章