Bug 1456157

Summary: system-config-selinux won't start
Product: [Fedora] Fedora Reporter: Michael <bugs>
Component: setoolsAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: alexl, caillon+fedoraproject, caolanm, cpebenito, dwalsh, frank, john.j5live, mbarnes, mgrepl, plautrba, pmoore, rhughes, rstrode, sandmann, starsareblueandfaraway, vmojzis
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: setools-4.1.0-5.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-09 23:54:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael 2017-05-27 10:02:10 UTC
Fedora 25: starts in x.org session, but not in Wayland session (Version     : 2.5
Release     : 20.fc25)



Fedora 26: won't start at all

Traceback (most recent call last):
  File "/usr/share/system-config-selinux/system-config-selinux.py", line 38, in <module>
    import booleansPage
  File "/usr/share/system-config-selinux/booleansPage.py", line 28, in <module>
    import seobject
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 34, in <module>
    import sepolicy
  File "/usr/lib/python2.7/site-packages/sepolicy/__init__.py", line 8, in <module>
    import setools
  File "/usr/lib64/python2.7/site-packages/setools/__init__.py", line 31, in <module>
    from . import policyrep
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/__init__.py", line 26, in <module>
    from .bounds import BoundsRuletype
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/bounds.py", line 24, in <module>
    from .util import PolicyEnum
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/util.py", line 21, in <module>
    from enum import Enum
ImportError: No module named enum

Comment 1 Franklyundead 2017-08-03 11:59:56 UTC
Same problem here, things I've done so far:

- Installed everything named "policycoreutils" from Yumex DNF
- Installed all system updates
- Set SELinux permissive
- Other gui tools (SELinux Policy Management Tool) do open
- Same error, running:

Fedora 26 XFCE all updates installed:

[frank@knarftop ~] $ uname -a
Linux knarftop 4.11.11-300.fc26.x86_64 #1 SMP Mon Jul 17 16:32:11 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


[frank@knarftop ~] $ system-config-selinux
Traceback (most recent call last):
  File "/usr/share/system-config-selinux/system-config-selinux.py", line 38, in <module>
    import booleansPage
  File "/usr/share/system-config-selinux/booleansPage.py", line 28, in <module>
    import seobject
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 34, in <module>
    import sepolicy
  File "/usr/lib/python2.7/site-packages/sepolicy/__init__.py", line 8, in <module>
    import setools
  File "/usr/lib64/python2.7/site-packages/setools/__init__.py", line 31, in <module>
    from . import policyrep
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/__init__.py", line 26, in <module>
    from .bounds import BoundsRuletype
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/bounds.py", line 24, in <module>
    from .util import PolicyEnum
  File "/usr/lib64/python2.7/site-packages/setools/policyrep/util.py", line 21, in <module>
    from enum import Enum
ImportError: No module named enum

Comment 2 starsareblueandfaraway 2017-09-06 14:38:15 UTC
As a workaround, you can install python-enum34

    sudo dnf -y install python-enum34

The enum package is in Python 3 but not in Python 2. The enum34 package backports enum to Python 2.



The root cause is the following line in setools/policyrep/util.py

    from enum import Enum

https://github.com/TresysTechnology/setools/commit/fcadd71b2403856df158f387500cd33c501fb97c#diff-9197a2a06b6affeed4ab2a1896d8433eR21
https://github.com/TresysTechnology/setools/blob/master/tox.ini
https://travis-ci.org/TresysTechnology/setools/jobs/269068537#L2226



I ran into this issue while trying to run the ansible seport module, which imports seobject, which uses policyrep/util.py. The ansible seport module will fail on Fedora 26 with the following error message: 

    This module requires policycoreutils-python

To fix this issue, include the following command in ansible:

    - name: install system packages
      package: name={{ item }} state=present
      become: true
      with_items:
        - libselinux-python
        - policycoreutils-python
        - python-enum34

Comment 3 Petr Lautrbach 2017-09-06 14:54:19 UTC
Thanks for the report! I'll push an update asap. The fix is already in git.

https://src.fedoraproject.org/rpms/setools/c/03687f1d4b00888adbaab4525c602621f47a702d?branch=f26

Comment 4 Fedora Update System 2017-09-06 14:55:48 UTC
setools-4.1.0-5.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-fd03fdb4da

Comment 5 Fedora Update System 2017-09-08 00:23:51 UTC
setools-4.1.0-5.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-fd03fdb4da

Comment 6 Fedora Update System 2017-09-09 23:54:20 UTC
setools-4.1.0-5.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.