问题如下
`# systemctl start firewalld
Job for firewalld.service failed because the control process exited with error code. See "systemctl status firewalld.service" and "journalctl -xe" for details.`
firewall-cmd --reload
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
有看到别的老哥说:
其实当输入 firewall-cmd 系列的命令的时候都会报错
原因
因为自己的linux上安装了多个python版本,在启动防火墙时,系统不知道指向了。
解决
修改firewalld文件头版本指向就可以,改成2.7(原先是python)
命令:
vi /usr/sbin/firewalld
命令2:
vi /usr/bin/firewall-cmd
同样修改头文件指向为2.7版本~
然后重启,本来以为这样就可以了,结果又报错,说是什么找不到bus:
然后解决办法就是安装相关模块依赖:
执行命令:
yum install python-gobject -y
yum install python-firewall -y
然后安装成功后再次重启防火墙:
启动成功了~
参考文章:
- https://blog.csdn.net/com_ma/article/details/78040517
- 2021年CentOS7关于Firewalld防火墙失效报错问题处理
- Linux——centos7防火墙重启失败