Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1599114 - RHEL7: fixfiles doesn't label the rule added by "semanage fcontext" due to /etc/selinux/fixfiles_exclude_dirs
Summary: RHEL7: fixfiles doesn't label the rule added by "semanage fcontext" due to /e...
Status: CLOSED DUPLICATE of bug 1559808
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: policycoreutils
Version: 7.5
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Vit Mojzis
QA Contact: BaseOS QE Security Team
Depends On:
TreeView+ depends on / blocked
Reported: 2018-07-09 01:49 UTC by kyoneyama
Modified: 2018-07-09 23:53 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-07-09 16:10:24 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description kyoneyama 2018-07-09 01:49:21 UTC
Description of problem:

When there is "/etc/selinux/fixfiles_exclude_dirs", it doesn't label the rule added by "semanage fcontext" during autorelabel on boot.

Autorelabel on boot runs "fixfiles restore".

If there is fixfiles_exclude_dirs, fixfiles performs the operations below, that creates a temporary `file_contexts` files and executes setfiles based on a temporary files.

  # cd /etc/selinux/targeted/contexts/files/
  # mktemp file_contexts.XXXXXXXXX
  # cp -p /etc/selinux/targeted/contexts/files/file_contexts file_contexts.WniqAxMKPP
  # cp -p /etc/selinux/targeted/contexts/files/file_contexts.subs_dist file_contexts.WniqAxMKPP.subs_dist
  # cp -p /etc/selinux/targeted/contexts/files/file_contexts.subs file_contexts.WniqAxMKPP.subs
  # cp -p /etc/selinux/targeted/contexts/files/file_contexts.homedirs file_contexts.WniqAxMKPP.homedirs
  # setfiles -v -e /boot/efi -q /etc/selinux/targeted/contexts/files/file_contexts.WniqAxMKPP /

However, a temporary file of /etc/selinux/targeted/contexts/files/file_contexts.local isn't created, which additional rules are logged.
That's why fixfiles can't label additional rules.

Version-Release number of selected component (if applicable):

  - Red Hat Enterprise Linux 7.5
  - policycoreutils-2.5-22.el7

How reproducible:

  - Always

Steps to Reproduce:

1. Add local labeling rule with "semanage fcontext"

  # mkdir /share
  # semanage fcontext -a -t samba_share_t /share

2. Create /etc/selinux/fixfiles_exclude_dirs

  # echo "/boot/efi" > /etc/selinux/fixfiles_exclude_dirs

3. Execute "fixfiles restore"

  # fixfiles -v restore

4. Ensure the file context of /share

  # ls -ldZ /share

Actual results:

  - It doesn't label additional labels.

Expected results:

  - It can label additional labels.

Additional info:

Comment 3 Vit Mojzis 2018-07-09 16:10:24 UTC
Thank you for reporting the issue. 
We have a fix which will be released soon. Please see for more details.

*** This bug has been marked as a duplicate of bug 1559808 ***

Note You need to log in before you can comment on or make changes to this bug.