9

My firewall is currently inactive.

systemctl status firewalld firewalld.service Loaded: masked (/dev/null) Active: inactive (dead)

I used the following command to enable the firewall

# systemctl unmask firewalld 

but I got this error:

# systemctl unmask firewalld 
Failed to issue method call: Access denied

# sudo systemctl restart firewalld
Failed to issue method call: Unit firewalld.service failed to load: No such file or directory. 

# sudo systemctl enable firewalld 
Failed to issue method call: Access denied 
2
4

Here's what worked for me.

Check for hanging firewalld proceses, e.g:

root  16278  1  4 Jan 13 ?  00:00:00 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

kill them and then:

# yum reinstall firewalld
# service unmask firewalld
# service enable firewalld
# service start firewalld

And of course, look in journalctl to see what happened earlier.

3

This is highly recommended that you have a firewall protecting your server:

This error comes when you are trying to start or enable service which is either not installed on your Linux system or you typed an incorrect service name. See list of Services by typing:

systemctl list-units --type=service

Install if not available:

yum install firewalld

You can enable firewalld by typing:

systemctl enable firewalld
sudo systemctl enable firewalld

You can start firewalld by typing:

systemctl start firewalld
sudo systemctl start firewalld

Have a look to check its status by typing:

systemctl status firewalld
1
  • This is correct. The OP does not have firewalld installed, and needs to install it. – Michael Hampton Sep 7 '20 at 15:15
3

solution

sudo systemctl unmask --now firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
0

If it's just for permissions then maybe you can try to

sudo su
systemctl enable firewalld
systemctl start firewalld
0

Also if you want to use iptables rather then firewalld as your firewall of choice on centos 7 see How to enable iptables (instead of firewalld) services on RHEL 7 and Fedora 18?, which includes the exact instructions on how to install and enable iptables for RHEL 7/centos 7.

2
  • What does that link include? – Pierre.Vriens May 16 '16 at 16:34
  • The exact instructions on how to install and and enable iptables for RHEL 7/centos 7 . – Peter May 16 '16 at 17:06
0

Personally i prefer the old good iptables user space interface. So:

Initially disable firewalld. In your case this may be not necessary:

systemctl disable firewalld

Then install iptables:

yum install iptables-services

Enable iptables service:

systemctl enable iptables

Now you can save your rules as usual:

service iptables save
0

The reason could be following link might be broken

/etc/systemd/system/firewalld.service -> /usr/lib/systemd/system/firewalld.service

create it manually by issuing following commands

ln -s /usr/lib/systemd/system/firewalld.service /etc/systemd/system/

Then enable the firewall and start

systemctl enable firewalld

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-12-21 00:13:34 GMT; 2s ago
Docs: man:firewalld(1)
Main PID: 3020 (firewalld)
CGroup: /system.slice/firewalld.service
└─3020 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.