Systemctl & firewalld error

Hello Fedora community,

I would like to ask you for a help with firewalld. When I execute the following command:

$ sudo systemctl status firewalld

Then, I get the following outcome:

○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
     Active: inactive (dead) since Mon 2023-03-20 10:56:58 EET; 23s ago
   Duration: 406ms
       Docs: man:firewalld(1)
    Process: 9271 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 9271 (code=exited, status=0/SUCCESS)
        CPU: 725ms

Mar 20 10:56:57 fedora systemd[1]: Starting firewalld.service - firewalld - dynamic firewall daemon...
Mar 20 10:56:57 fedora systemd[1]: Started firewalld.service - firewalld - dynamic firewall daemon.
Mar 20 10:56:57 fedora firewalld[9271]: ERROR: Failed to load user configuration. Falling back to full stock configuration.
Mar 20 10:56:58 fedora firewalld[9271]: ERROR: PARSE_ERROR: Unexpected element direct
Mar 20 10:56:58 fedora firewalld[9271]: Traceback (most recent call last):
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 629, in start
                                            self._start()
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 579, in _start
                                            self._start_load_stock_config()
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 396, in _start_load_stoc>
                                            self._loader_services(config.FIREWALLD_SERVICES)
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 670, in _loader_services
                                            obj = service_reader(filename, path)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/service.py", line 237, in service_>
                                            parser.parse(source)
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 111, in parse
                                            xmlreader.IncrementalParser.parse(self, source)
                                          File "/usr/lib64/python3.11/xml/sax/xmlreader.py", line 125, in parse
                                            self.feed(buffer)
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 217, in feed
                                            self._parser.Parse(data, isFinal)
                                          File "/builddir/build/BUILD/Python-3.11.2/Modules/pyexpat.c", line 416, in StartElement
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 333, in start_element
                                            self._cont_handler.startElement(name, AttributesImpl(attrs))
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/service.py", line 140, in startEle>
                                            self.item.parser_check_element_attrs(name, attrs)
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/io_object.py", line 183, in parser>
                                            raise FirewallError(errors.PARSE_ERROR,
                                        firewall.errors.FirewallError: PARSE_ERROR: Unexpected element direct
                                        
                                        During handling of the above exception, another exception occurred:
                                        
                                        Traceback (most recent call last):
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 634, in start
                                            self._start_failsafe()
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 618, in _start_failsafe
                                            self._start_load_stock_config()
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 396, in _start_load_stoc>
                                            self._loader_services(config.FIREWALLD_SERVICES)
                                          File "/usr/lib/python3.11/site-packages/firewall/core/fw.py", line 670, in _loader_services
                                            obj = service_reader(filename, path)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/service.py", line 237, in service_>
                                            parser.parse(source)
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 111, in parse
                                            xmlreader.IncrementalParser.parse(self, source)
                                          File "/usr/lib64/python3.11/xml/sax/xmlreader.py", line 125, in parse
                                            self.feed(buffer)
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 217, in feed
                                            self._parser.Parse(data, isFinal)
                                          File "/builddir/build/BUILD/Python-3.11.2/Modules/pyexpat.c", line 416, in StartElement
                                          File "/usr/lib64/python3.11/xml/sax/expatreader.py", line 333, in start_element
                                            self._cont_handler.startElement(name, AttributesImpl(attrs))
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/service.py", line 140, in startEle>
                                            self.item.parser_check_element_attrs(name, attrs)
                                          File "/usr/lib/python3.11/site-packages/firewall/core/io/io_object.py", line 183, in parser>
                                            raise FirewallError(errors.PARSE_ERROR,
                                        firewall.errors.FirewallError: PARSE_ERROR: Unexpected element direct
Mar 20 10:56:58 fedora firewalld[9271]: ERROR: PARSE_ERROR: Unexpected element direct
Mar 20 10:56:58 fedora firewalld[9271]: ERROR: Failed to load full stock configuration. This likely indicates a system level issue, e>
Mar 20 10:56:58 fedora firewalld[9271]: ERROR: Raising SystemExit in run_server
Mar 20 10:56:58 fedora systemd[1]: firewalld.service: Deactivated successfully.

May I request you for your advice how to start and enable firewalld to work and to be active again?

Thank you!

Did you mess around with your python install?
Have you tried sudo dnf reinstall firewalld already?

Hello,

Thank you for responding.

Yes - I did it but it didn’t work. In addition to reinstalling/restarting/reloading firewalld, I also tried:

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

Unfortunately, it didn’t work.

firewall-cmd --reload

and maybe try this one. (don’t just remove the file, mv it somewhere temporarily): 1716080 – service file '/usr/lib/firewalld/services/tcpcryptd.xml': PARSE_ERROR: Unexpected element direct

Thank you very much! Just ‘mv’ the ‘tcpcryptd.xml’ file to another directory, reloaded the firewall-cmd, unmasked ‘firewalld’, started it and enabled it. Now it works!

Thank you once again for the quick response! Cheers! :wink:

To follow up:

On the question whether I was messing with the python install, maybe the answer is yes but I am not sure. I program in Python and recently (group) installed the Fedora Scientific Group, Python Classroom and Python Science in order to test the different GUI for programming in R, Python, Octave, etc. Probably, with those installations there were some Python-related installs. Would you please give me an advice what should I avoid to install in order to avoid similar problems in the future? As far as I know, Python comes pre-installed on Fedora, so I did not installed by myself (unless it was installed through those group installs I mentioned above).

Thank you once again!