How to solve the problem of CentOS firewall startup failure
Suddenly I found that the centos 7 firewall could not be started, and the firewall-cmd command reported an error, the firewall The startup error is as follows:
[root@localhost firewalld]# systemctl start firewalld.service Job for firewalld.service failed because the control process exited with error code. See "systemctl status firewalld.service" and "journalctl -xe" for details. [root@localhost firewalld]# 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 三 2020-01-08 10:43:48 CST; 10s ago Docs: man:firewalld(1) Process: 29630 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=127) Main PID: 29630 (code=exited, status=127)
The firewall-cmd command runs the error as follows: (Recommended learning:Linux video tutorial)
[root@localhost yangl]# firewall-cmd Traceback (most recent call last): File "/usr/bin/firewall-cmd", line 24, infrom gi.repository import GObject ImportError: No module named gi.repository
The reasonis due to the use of Customize the installed pythonand use your own installed python as the default python (in addition, upgrading the system default python to python3 may also cause similar problems), so justreplace firewalld and firewall-cmd Changing the python called in the first line to the system python canbe solved.
My python linking method is as follows:
[root@localhost yangl]# cd /usr/bin/ [root@localhost bin]# ll python* lrwxrwxrwx. 1 root root 16 9月 28 2018 python -> /usr/bin/python2 lrwxrwxrwx. 1 root root 39 9月 28 2018 python2 -> /share/soft/python-2.7.15/bin/python2.7 -rwxr-xr-x. 1 root root 7216 7月 13 2018 python2.7 #系统的python lrwxrwxrwx. 1 root root 9 9月 28 2018 python2_old -> python2.7 lrwxrwxrwx. 1 root root 36 3月 7 2018 python3 -> /share/soft/python-3.6.4/bin/python3 lrwxrwxrwx. 1 root root 7 9月 28 2018 python_old -> python2
So, just vi open /usr/sbin/firewalld and /usr/bin/firewall-cmd, and change the first line by # !/usr/bin/python -Es can be changed to #!/usr/bin/python2.7 -Es!
This article comes from the PHP Chinese website,CentOS usage tutorialcolumn, please pay attention to this column for more related tutorials!
The above is the detailed content of How to solve the problem of CentOS firewall opening failure. For more information, please follow other related articles on the PHP Chinese website!