Why leapp preupgrade fails with error "ParseError: no element found: line 1, column 0" ?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7, 8, 9
  • Leapp

Issue

  • Leapp preupgrade fails with below error :
Risk Factor: high (error)
Title: Actor firewalld_facts_actor unexpectedly terminated with exit code: 1
Summary: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 74, in _do_run
    actor_instance.run(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 289, in run
    self.process(*args)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/firewalldfactsactor/actor.py", line 33, in process
    tree = ElementTree.parse('/etc/firewalld/direct.xml')
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 657, in parse
    self._root = parser.close()
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
ParseError: no element found: line 1, column 0

Resolution

  • Please remove the below file & rerun the leapp preupgrade process.
# rm /etc/firewalld/direct.xml

Diagnostic Steps

  • The below error shows that the leapp firewalld facts actor is parsing a file in /etc/firewalld/ directory called direct.xml
...
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/firewalldfactsactor/actor.py", line 33, in process
    tree = ElementTree.parse('/etc/firewalld/direct.xml')
...
  • The code is not expecting a blank file and does not know what to do resulting in the end result.
ParseError: no element found: line 1, column 0
  • Verify that the file mentioned in the traceback is not blank. If blank,we need to remove it.
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.