Knowledge Base:Emerge fails with permission denied on make.conf

From Gentoo Wiki
Jump to:navigation Jump to:search

Synopsis

Any activity using emerge, such as emerge --info, fails with the following error:

root #emerge --info
Permission denied: '/etc/portage/make.conf'

Environment

This article is applicable to Gentoo Linux systems using a selinux profile:

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

SELinux profiles always end with /selinux.

Analysis

This is to be expected when not using the sysadm_r role. Any Portage related activity requires that the sysadm_r role be used; this is because other roles have no access to the /etc/portage/make.conf file (which should be labeled system_u:object_r:portage_conf_t).

Resolution

Verify that the current context is within the sysadm_r role (second part of the context):

user $id -Z
staff_u:sysadm_r:sysadm_t

If this is not the case, use newrole to switch roles after re-authenticating with a personal password:

user $newrole -r sysadm_r
Password: