Centos开启防火墙超时失败

CnetOS命令

CentOS关闭防火墙命令:

1
2
3
systemctl stop firewalld
# 或者
service firewalld stop

CentOS启动防火墙

1
2
3
systemctl start firewalld
# 或者
service firewalld start
关闭防火墙后再次启动防火墙,发现无法启动,错误是超时:
1
2
3
[root@localhost ~]service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
Job for firewalld.service failed because a timeout was exceeded. See "systemctl status firewalld.service" and "journalctl -xe" for details.
解决办法:

需要关闭firewalld进程,再启动firewalld

1
2
3
systemctl stop firewalld    #停止firewalld
pkill -f firewalld #关闭firewalld进程
systemctl start firewalld #启动firewalld

官方解释可能原因: systemd didn’t know about the process that it didn’t start in the first place of course

参考链接:Centos执行开启防火墙命令超时