CentOS防火墙开启失败怎么解决


本文摘自PHP中文网,作者angryTom,侵删。

CentOS防火墙开启失败怎么解决

突然之间发现centos 7 的防火墙无法启动,且firewall-cmd命令运行报错,防火墙启动报错如下:

1

2

3

4

5

6

7

8

9

[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)

firewall-cmd命令运行报错如下:(推荐学习:Linux视频教程)

1

2

3

4

5

[root@localhost yangl]# firewall-cmd

Traceback (most recent call last):

  File "/usr/bin/firewall-cmd", line 24, in <module>

    from gi.repository import GObject

ImportError: No module named gi.repository

究其原因是由于使用了自定义安装的python,并将自己安装的python作为默认python导致(此外,将系统默认的python升级为python3也可能会出现类似问题),因此只需将firewalld和firewall-cmd第一行调用的python改为系统的python即可解决。

阅读剩余部分

相关阅读 >>

如何备份CentOS的系统

CentOS下mysql安装失败怎么办

CentOS各版本区别是什么

CentOS 安装php mysql扩展

CentOS下如何使用yum命令清空缓存列表

CentOS修改root密码的方法

CentOS怎么把文件移动?

如何在CentOS和rhel上安装最新的nodejs

linux系统CentOS是什么?

CentOS 查看ip的方法(图文)

更多相关阅读请进入《CentOS》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...