Profile (Portage)

From Gentoo Wiki
Jump to: navigation, search

A Portage profile specifies default values for global and per-package USE flags, specifies default values for most variables found in /etc/portage/make.conf, and defines a set of system packages. It masks unstable package versions and USE flags. The profiles are maintained by the Gentoo developers as part of the Gentoo repository (/usr/portage/profiles), but there are ways for users to override single pieces.


List profiles

List the available profiles with eselect:

root #eselect profile list
Available profile symlink targets:
  [1]   default/linux/amd64/13.0 *
  [2]   default/linux/amd64/13.0/selinux
  [3]   default/linux/amd64/13.0/desktop
  [4]   default/linux/amd64/13.0/desktop/gnome
  [5]   default/linux/amd64/13.0/desktop/gnome/systemd
  [6]   default/linux/amd64/13.0/desktop/plasma
  [7]   default/linux/amd64/13.0/desktop/plasma/systemd
  [8]   default/linux/amd64/13.0/developer
  [9]   default/linux/amd64/13.0/no-multilib
  [10]  default/linux/amd64/13.0/systemd
  [11]  default/linux/amd64/13.0/x32
  [12]  hardened/linux/amd64
  [13]  hardened/linux/amd64/selinux
  [14]  hardened/linux/amd64/no-multilib
  [15]  hardened/linux/amd64/no-multilib/selinux
  [16]  hardened/linux/amd64/x32
  [17]  hardened/linux/musl/amd64
  [18]  hardened/linux/musl/amd64/x32
  [19]  default/linux/uclibc/amd64
  [20]  hardened/linux/uclibc/amd64

The "normal" profiles are the ones beginning with default, followed by subprofiles for kernel (linux or bsd), architecture (x86, amd64, etc.), release number (13.0) and target (desktop, server, developer, etc.). The desktop subprofile has also the subprofiles gnome, kde and plasma.

The asterisk marks your currently active profile.

Change profile

Change the profile using eselect, e.g. for a KDE desktop:

root #eselect profile set 6


All profiles are cascading/stackable profiles composed by several subprofiles. Each subprofile (corresponding to a directory under /usr/portage/profiles) can contain files to set some defaults. Lower level subprofiles (e.g default/linux/amd64) also can have a file called parent, which pulls in one or more other higher level subprofiles (here: default/linux, arch/amd64 and base). Defaults defined in a lower level subprofile overwrites all conflicting defaults in higher subprofiles.

Following is an example for the stacked profile default/linux/amd64/13.0/desktop/kde showing the dependencies:

CODE Stacked profiles example
|-- arch
|   |-- amd64 <--------------.
|   |   `-- parent >-------- | ----------------------.
|   -- base <--------------- | ----------------------|
|-- base <-------------------|                       |
|-- default                  |                       |
|   `-- linux <--------------|                       |
|       `-- amd64 <--------- | ------------------.   |
|           |-- parent >-----'                   |   |
|           `-- 13.0 <-----------------------.   |   |
|               |-- parent >---------------- | --|   |
|               `-- desktop <------------.   |   |   |
|                   |-- parent >-------- | --|   |   |
|                   `-- kde              |   |   |   |
|                       `-- parent >-----|   |   |   |
|-- features                             |   |   |   |
|   `-- multilib <-----------.           |   |   |   |
|       `-- lib32 <--------- | --------- | - | - | --'
|           `-- parent >-----'           |   |   |
|-- releases <-----------.               |   |   |
|   `-- 13.0 <---------- | ------------- | - | --'
|       `-- parent >-----'               |   |
`-- targets                              |   |
    `-- desktop <----------------------- | --'
        `--kde <----------- | -----------'
           `-- parent >-----'

The following table gives a quick overview of what subprofile contain what files:

base default
releases releases
eapi Yes No No No No No Yes Yes Yes No No No Yes No No
make.defaults No Yes No Yes Yes No No No No Yes Yes Yes Yes Yes Yes
packages No No No Yes Yes No No No No No No No No No No No No No No Yes No No No No No No No No No No
package.mask Yes No No Yes No No No No No No No No Yes No No
package.use No No No Yes Yes No No No No No No No No Yes Yes
package.use.force No Yes No Yes No No No No No No No No No No No
package.use.mask No Yes No Yes Yes No No No No No No No No No No
profile.bashrc No No No Yes No No No No No No No No No No No
use.force No Yes No Yes No No No No No Yes No No No No Yes
use.mask No Yes Yes Yes No No No No No Yes No No No No No

Combining profiles

If there isn't a profile in the Portage tree that meets your exact requirements, you can try combining multiple profiles into a single custom profile. An example of this would be combining a hardened profile with a desktop systemd profile, such as default/linux/amd64/13.0/desktop/plasma/systemd and hardened/linux/amd64. It is expected that you already have a local repository set up.

The order in which the profiles are listed in the parent file can drastically affect which features will be enabled/disabled system-wide. If you have emerge resolution problems after switching to the custom profile, try changing the order of the lines in the parent file. It may be impossible to get some combinations to work correctly. Your mileage may vary!
  1. Create a profile name for your hybrid profile. For instance, the combination mentioned above could be named:


  2. Create the directory structure in your local repository:

    root #local_repo=/usr/local/portage # A common location for the local repository
    root #profile_name=hardened/linux/amd64/13.0/desktop/plasma/systemd
    root #mkdir -p $local_repo/profiles/$profile_name

  3. Reference the profiles from the Portage tree and store them in your new profile's parent file:

    root #portage_dir=/usr/portage # A common location for the Portage tree
    root #for p in default/linux/amd64/13.0/desktop/plasma/systemd hardened/linux/amd64
    > do
    >     realpath --relative-to=$local_repo/profiles/$profile_name $portage_dir/profiles/$p
    > done > $local_repo/profiles/$profile_name/parent

  4. Insert the newly created profile in your repository's profiles.desc:

    root #arch=amd64 # Your architecture of choice
    root #type=stable # The profile's type: stable or dev
    root #echo "$arch $profile_name $type" >> $local_repo/profiles/profiles.desc

  5. Switch to the new profile using eselect:

    root #eselect profile list
     [21] local:hardened/linux/amd64/13.0/desktop/plasma/systemd

    root #eselect profile set 21

  6. Run a world rebuild:

    root #emerge -DNuva @world