Knowledge Base:Portage fails to label files because setfiles does not work anymore

Synopsis
When trying to (re)install software, Portage breaks during the Setting SELinux security labels phase. The below error message is an example of this:

Environment
This article applies to Gentoo Linux installations with a SELinux profile:

Analysis
If for some reason setfiles does not work anymore, any install activity performed by Portage will fail since it calls setfiles during each installation. Rebuilding thus fails.

Resolution
Rebuild but disable Portage' SELinux support.

Then, run rlpkg to fix the labels of the package