leapp upgrade fails with AttributeError: module 'selinux' has no attribute 'security_getenforce'

Solution Verified - Updated -

Issue

Leapp upgrade results in following error

        Provides data about package manager (yum/dnf)
====> * system_facts
        Provides data about many facts from system.
Process Process-246:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/site-packages/leapp/repository/actor_definition.py", line 74, in _do_run
    actor_instance.run(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/leapp/actors/__init__.py", line 289, in run
    self.process(*args)
  File "/etc/leapp/repos.d/system_upgrade/common/actors/systemfacts/actor.py", line 58, in process
    self.produce(systemfacts.get_selinux_status())
  File "/etc/leapp/repos.d/system_upgrade/common/actors/systemfacts/libraries/systemfacts.py", line 237, in get_selinux_status
    outdata['runtime_mode'] = "enforcing" if selinux.security_getenforce() == 1 else "permissive"
AttributeError: module 'selinux' has no attribute 'security_getenforce'

Environment

Red Hat Enterprise Linux 8
leapp in place upgrade from RHEL 8 to RHEL 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content