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

From Gentoo Wiki
Jump to: navigation, search

Synopsis

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: libaudit.so.1: cannot
open shared object file: No such file or directory

Environment

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

root #eselect profile show
Current /etc/make.profile symlink:
  hardened/linux/amd64/selinux

Analysis

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.

Resolution

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