Centos7防火墙关闭后启动不了Failed to start firewalld

博客指出CentOS7系统中防火墙关闭后无法启动,原因是firewalld依赖python,安装python3时将默认python命令别名指向python3所致。解决办法是找到firewalld位置,将/usr/sbin/firewalld文件首行的python改为python2。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-05-01 02:28:27 CST; 8s ago
     Docs: man:firewalld(1)
  Process: 17012 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=1/FAILURE)
 Main PID: 17012 (code=exited, status=1/FAILURE)

May 01 02:28:27 VM_75_146_centos systemd[1]: Starting firewalld - dynamic firewall daemon...
May 01 02:28:27 VM_75_146_centos systemd[1]: firewalld.service: main process exited, code=exited, status=1/FAILURE
May 01 02:28:27 VM_75_146_centos systemd[1]: Failed to start firewalld - dynamic firewall daemon.
May 01 02:28:27 VM_75_146_centos systemd[1]: Unit firewalld.service entered failed state.
May 01 02:28:27 VM_75_146_centos systemd[1]: firewalld.service failed.

centos7防火墙关闭后启动不了。

原因:

firewalld依赖于python,由于之前安装python3的时候,将默认python命令的别名指向了python3,造成无法启动

解决办法:

1、先找到firewalld的位置

[root@VM_75_146_centos ~]# which firewalld
/usr/sbin/firewalld

2、将/usr/sbin/firewalld文件的第一行修改为旧的python

vim /usr/sbin/firewalld
#!/usr/bin/python2 -Es
# -*- coding: utf-8 -*-

将原来的python改为python2即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值