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

From Gentoo Wiki
Jump to:navigation Jump to:search


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

root #emerge ...
>>> Setting SELinux security labels
/usr/sbin/setfiles: error while loading shared libraries: cannot
open shared object file: No such file or directory


This article applies to Gentoo Linux installations with a selinux profile:

root #eselect profile show
Current /etc/make.profile symlink:


If for some reason setfiles no longer works, any install activity performed by Portage will fail since it calls setfilesduring each installation. Rebuilding sys-apps/policycoreutils thus fails.


Rebuild sys-apps/policycoreutils but temporarily disable SELinux support:

root #FEATURES="-selinux" emerge -1 policycoreutils

Then, run rlpkg to fix the labels of the package:

root #rlpkg policycoreutils