How to solve the problem of CentOS firewall opening failure

angryTom
Release: 2020-03-17 18:17:57
Original
4873 people have browsed it

How to solve the problem of CentOS firewall opening failure

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)
Copy after login

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, in 
    from gi.repository import GObject
ImportError: No module named gi.repository
Copy after login

The reason is due to the use of Customize the installed python and 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 can be 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
Copy after login

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 tutorial column, 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!