centos防火墻開(kāi)啟失敗怎么解決
突然之間發(fā)現(xiàn)centos 7 的防火墻無(wú)法啟動(dòng),且firewall-cmd命令運(yùn)行報(bào)錯(cuò),防火墻啟動(dòng)報(bào)錯(cuò)如下:
[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命令運(yùn)行報(bào)錯(cuò)如下:(推薦學(xué)習(xí):Linux視頻教程)
[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</module>
究其原因是由于使用了自定義安裝的python,并將自己安裝的python作為默認(rèn)python導(dǎo)致(此外,將系統(tǒng)默認(rèn)的python升級(jí)為python3也可能會(huì)出現(xiàn)類(lèi)似問(wèn)題),因此只需將firewalld和firewall-cmd第一行調(diào)用的python改為系統(tǒng)的python即可解決。
我的python鏈接方式如下:
[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??????#系統(tǒng)的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
因此,只需vi打開(kāi)/usr/sbin/firewalld 和/usr/bin/firewall-cmd,將其中的第一行由#!/usr/bin/python -Es 改為 #!/usr/bin/python2.7 -Es 即可!
本篇文章來(lái)自PHP中文網(wǎng),Linux視頻教程欄目,更多相關(guān)教程請(qǐng)關(guān)注本欄目!
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END