Red Hat Bugzilla – Bug 1472709
setfiles now requires "-m" to restore contexts in some chroot environments
Last modified: 2018-05-29 08:08:21 EDT
diskimage-builder builds a fedora image within a chroot environment on a host. This is happening on an ubuntu xenial system -- this is part of building images for use by the OpenStack CI environment. We have long had a final step before we create the final image of running "setfiles" within the chroot of the final image to restore contexts so that the image we are building boots quickly 
Unfortunately this stopped working with F26. The setfiles just does nothing at all
# setfiles -d /etc/selinux/targeted/contexts/files/file_contexts /
# echo $?
If I take the F25 setfiles binary and run it, it works. So that got me digging into git history, where I noticed the suspect change where F26 has started using selinux_restorecon .
Reading this change I noticed "-m"
... do not read /proc/mounts to obtain a list of non-seclabel mounts ...
and realised that we're in a chroot environment on a loopback disk on an ubuntu system, so this is probably not matching. So long story short, the "-m" fixed things for me
I get that what is happening with diskimage-builder is pretty uncommon usage, but it is pretty painful having setfiles having no error code or any output indication of what's going on at all without this flag, when it's been working for literally years. I had to first figure out how to break into our vms (because lack of selinux meant nothing could log in), figure out it was selinux at fault, then spend considerable time figuring out that the 'setfiles' was doing nothing now during the build, and then correlating this with git history ...
Maybe the cat is out of the bag; but it would be my suggestion that "-m" should be applied by default on setfiles to maintain the behavior with the prior versions. if anything, a flag should be inverted to turn it off.
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.