From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Portage and the translation is 10% complete.

Portage es el sistema de gestión de paquetes oficial y sistema de distribución para Gentoo. Funciona como el corazón de los sistemas operativos basados en gentoo, dando resolución avanzada a dependencias, construcción flexible e instalación de software desde la fuente, incluyendo herramientas para producir, controlar y distribuir archivos binarios entre otras funcionalidades.

Portage proveerá software desde el repositorio de ebuilds de Gentoo, y desde cualquier repositorio adicional que sea necesario. Portage incluye muchos comandos para repositorios y manejo de paquetes, el principal es el comando emerge

Algunas preguntas frecuentes a cerca de portage y el comando emerge se responden en FAQ y en Portage FAQ (en inglés).

En el día a día, el emerge, emaint, y dispatch-conf serán los comandos de Portage más usados. Observe la documentación relevante.
See also
Vea man portage para la documentación completa a usuarios. Revise el artículo emerge por insformación de como instalar y mantener paquetes con Portage.

Este artículo describe a Portage desde la mirada del usuario. Quienes busquen contribuir con el desarrollo de Portage deberán visitar la página del proyecto Portage.


Todos los instaladores traen Portage por lo que ¡no hay necesidad de instalarlo!.

En cosa de una rara eventualidad donde Portage se corrompa o se pierda, vea la sección Portage corrupto o ausente.

Actualizando Portage

Para mantener Gentoo al día, Portage debe estar al día. Generalmente la cotidiana actualización de Gentoo automáticamente actualizará Portage sin problemas.

En ocasiones, actualizaciones de Portage pueden aconsejarse antes que el resto del sistema. Luego de sincronizar Portage, un mensaje con este pedido puede aparecer:

* An update to portage is available. It is _highly_ recommended
* that you update portage now, before any other packages are updated.

* To update portage, run 'emerge --oneshot sys-apps/portage' now.

Emerge Portage as advised (adapt the command if the message differs from this example). The --oneshot option is important, to avoid adding sys-apps/portage to the world file:

root #emerge --ask --oneshot sys-apps/portage

If there is an issue with updating Portage, User:Sam/Portage_help/Upgrading_Portage may help.



The main Portage configuration is in make.conf, though there are many files used to configure Portage, mainly in the /etc/portage directory.

See man make.conf for comprehensive documentation, notably a list of variables that can be set in this file.

The /usr/share/portage/config/make.globals file contains many default configuration values sourced by Portage. These values can be overwritten by specifying the same variable names in /etc/portage/make.conf.

Environment variables

Portage can be configured to a vast extent through environment variables.

See man make.conf for information on available environment variables. Refer also to the Handbook section for working with environment variables in Gentoo.

To view all presently set environment variables, run:

user $emerge --info --verbose
Environment variables can be set on a per-package basis via /etc/portage/package.env entries.

Ebuild repositories

In addition to the Gentoo ebuild repository, from which Portage will pull packages by default, additional ebuild repositories are available, for example:

  • repos.gentoo.org - list of repositories contributed by the community, some by Gentoo developers
  • GURU - official ebuild repository maintained collaboratively by Gentoo users, with a little support from a few Gentoo developers
  • gpo.zugaina.org - third-party list of ebuild repositories

The ebuild repository article has a section on configuring ebuild repositories to be used by Portage.

Search for available ebuilds on the command line with emerge --search or eix.

While the Gentoo ebuild repository is either written or reviewed by Gentoo developers, and the GURU repository has some developer oversight, that is not always the case for other ebuild repositories. It is possible that some ebuilds repositories might contain vulnerable, badly broken or, theoretically, even malicious software.


Portage includes many different tools and utilities to help with system administration and maintenance. The following sections list these in alphabetical order.

The main commands users will need on a day to day basis are emerge, emaint, and dispatch-conf.


The purpose of archive-conf is to save off a config file in the dispatch-conf archive directory. Most users should not ever need to run this command:

root #archive-conf
Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]


The dispatch-conf utility is used to manage configuration file updates. See the dispatch-conf article.


ebuild is Portage's command for running the various ebuild functions.

This command is generally not run by the user and is useful only to developers. Do not try to use it to install packages, see rather the emerge command.

For disambiguation between this command and ebuild files, see the ebuild article.


The egencache tool rebuilds the cache of metadata information for the ebuild repositories. See the egencache article for additional information.


Performs package management related system health checks and maintenance.

See repository synchronization about how to use emaint to synchronize repositories. See man 1 emaint for detailed information.

The emerge --sync command is now implemented with emaint.
user $emaint --help
usage: usage: emaint [options] COMMAND
The emaint program provides an interface to system health checks
and maintenance. See the emaint(1) man page for additional
information about the following commands:
  all            Perform all supported commands
  binhost        Scan and generate metadata indexes for binary packages.
  cleanconfmem   Check and clean the config tracker list for uninstalled packages.
  cleanresume    Discard emerge --resume merge lists
  logs           Check and clean old logs in the PORTAGE_LOGDIR.
  merges         Scan for failed merges and fix them.
  movebin        Perform package move updates for binary packages
  moveinst       Perform package move updates for installed and binary packages.
  sync           Check repos.conf settings and sync repositories.
  world          Check and fix problems in the world file.
optional arguments:
  -h, --help            show this help message and exit
  -c, --check           Check for problems (a default option for most modules)
  -f, --fix             Attempt to fix problems (a default option for most modules)
  --version             show program's version number and exit
  -C, --clean           Cleans out logs more than 7 days old (cleanlogs only) module-options: -t, -p
  -t NUM, --time NUM    (cleanlogs only): -t, --time Delete logs older than NUM of days
  -p, --pretend         (cleanlogs only): -p, --pretend Output logs that would be deleted
  -P, --purge           Removes the list of previously failed merges. WARNING: Only use this option if you plan on manually fixing them or do not want them re-installed.
  -y, --yes             (merges submodule only): Do not prompt for emerge invocations
  -r REPO, --repo REPO  (sync module only): -r, --repo Sync the specified repo
  -A, --allrepos        (sync module only): -A, --allrepos Sync all repos that have a sync-url defined
  -a, --auto            (sync module only): -a, --auto Sync auto-sync enabled repos only
  --sync-submodule {glsa,news,profiles}
                        (sync module only): Restrict sync to the specified submodule(s)


emerge is the command-line interface to Portage and is how most users will interact with Portage.

See the emerge article for more information on the wiki.


Install a Gentoo ebuild repository snapshot from the web. See Handbook.

root #emerge-webrsync -h
Usage: /usr/bin/emerge-webrsync [options]
  --revert=yyyymmdd   Revert to snapshot
  -k, --keep          Keep snapshots in DISTDIR (don't delete)
  -q, --quiet         Only output errors
  -v, --verbose       Enable verbose output
  -x, --debug         Enable debug output
  -h, --help          This help screen (duh!)

emerge-webrsync is called internally by eix-sync when sync-type in /etc/portage/repos.conf is set to webrsync.


Tool for mirroring of package distfiles.

root #emirrordist -h
usage: emirrordist [options] <action>
emirrordist - a fetch tool for mirroring of package distfiles
optional arguments:
  -h, --help            show this help message and exit
  --version             display portage version and exit
  --mirror              mirror distfiles for the selected repository
Common options:
  --dry-run             perform a trial run with no changes made (usually
                        combined with --verbose)
  --verbose, -v         display extra information on stderr (multiple
                        occurences increase verbosity)
                        do not use the EMIRRORDIST_DEFAULT_OPTS environment
  --distfiles DIR       distfiles directory to use (required)
  --jobs JOBS, -j JOBS  number of concurrent jobs to run
  --load-average LOAD, -l LOAD
                        load average limit for spawning of new concurrent jobs
  --tries TRIES         maximum number of tries per file, 0 means unlimited
                        (default is 10)
  --repo REPO           name of repo to operate on
  --config-root DIR     location of portage config files
  --repositories-configuration REPOSITORIES_CONFIGURATION
                        override configuration of repositories (in format of
  --strict-manifests <y|n>
                        manually override "strict" FEATURES setting
  --failure-log FILE    log file for fetch failures, with tab-delimited
                        output, for reporting purposes
  --success-log FILE    log file for fetch successes, with tab-delimited
                        output, for reporting purposes
  --scheduled-deletion-log FILE
                        log file for scheduled deletions, with tab-delimited
                        output, for reporting purposes
  --delete              enable deletion of unused distfiles
  --deletion-db FILE    database file used to track lifetime of files
                        scheduled for delayed deletion
  --deletion-delay SECONDS
                        delay time for deletion, measured in seconds
  --temp-dir DIR        temporary directory for downloads
  --mirror-overrides FILE
                        file holding a list of mirror overrides
  --mirror-skip MIRROR_SKIP
                        comma delimited list of mirror targets to skip when
  --restrict-mirror-exemptions RESTRICT_MIRROR_EXEMPTIONS
                        comma delimited list of mirror targets for which to
                        ignore RESTRICT="mirror"
                        use digest as a verification of whether existing
                        distfiles are valid
  --distfiles-local DIR
                        distfiles-local directory to use
  --distfiles-db FILE   database file used to track which ebuilds a distfile
                        belongs to
  --recycle-dir DIR     directory for extended retention of files that are
                        removed from distdir with the --delete option
  --recycle-db FILE     database file used to track lifetime of files in
                        recycle dir
  --recycle-deletion-delay SECONDS
                        delay time for deletion of unused files from recycle
                        dir, measured in seconds (defaults to the equivalent
                        of 60 days)
  --fetch-log-dir DIR   directory for individual fetch logs
  --whitelist-from FILE
                        specifies a file containing a list of files to
                        whitelist, one per line, # prefixed lines ignored

See also man emirrordist.


Updates environment settings automatically.

root #env-update -h
Usage: env-update [--no-ldconfig]
See the env-update(1) man page for more info

See also man env-update. See the login article for some information on how the environment is set up in Gentoo.


dispatch-conf is now the recommended way to manage configuration file changes. Importantly, dispatch-conf permits the rollback of config changes.
root #etc-update -h
etc-update: Handle configuration file updates
Usage: etc-update [options] [paths to scan]
If no paths are specified, then ${CONFIG_PROTECT} will be used.
  -d, --debug    Enable shell debugging
  -h, --help     Show help and run away
  -p, --preen    Automerge trivial changes only and quit
  -q, --quiet    Show only essential output
  -v, --verbose  Show settings and such along the way
  -V, --version  Show version and trundle away
  --automode <mode>
             -3 to auto merge all files
             -5 to auto-merge AND not use 'mv -i'
             -7 to discard all updates
             -9 to discard all updates AND not use 'rm -i'


Perform package move updates for all packages.

root #fixpackages -h
usage: fixpackages [-h]
The fixpackages program performs package move updates on configuration files,
installed packages, and binary packages.
optional arguments:
  -h, --help  show this help message and exit

See also man fixpackages.


Regenerates the world file by checking the Portage logfile for all actions that done in the past.

Make a backup of existing world file (/var/lib/portage/world) before using this tool.
root #regenworld -h
This script regenerates the portage world file by checking the portage
logfile for all actions that you've done in the past. It ignores any
arguments except --help. It is recommended that you make a backup of
your existing world file (/var/lib/portage/world) before using this tool.


For details see portageq.


Creates Portage packages - see the Binary package guide for more information.

user $quickpkg --help
usage: quickpkg [options] <list of package atoms or package sets>
optional arguments:
  -h, --help            show this help message and exit
  --umask UMASK         umask used during package creation (default is 0077)
                        do not use the QUICKPKG_DEFAULT_OPTS environment variable
  --include-config <y|n>
                        include all files protected by CONFIG_PROTECT (as a security precaution, default is 'n')
  --include-unmodified-config <y|n>
                        include files protected by CONFIG_PROTECT that have not been modified since installation (as a
                        security precaution, default is 'n')

See also man quickpkg.


The information in this section has been deprecated. It may or may not be relevant for contemporary usage. Handle with care!

repoman is a development tool used for testing ebuilds. Since version 2.3.0, it is packaged separately from Portage, in app-portage/repoman. See the repoman article for additional information.

It is now deprecated in favor of tools provided by the dev-util/pkgcheck and dev-util/pkgdev packages.


Gentoo Linux Security Announcements, or GLSAs, are notifications sent out to the community to inform of security vulnerabilities related broadly to Gentoo Linux or specifically to packages contained in the ::gentoo ebuild repository.

glsa-check is a tool to keep track of the various GLSAs. It can be used to view GLSAs, but more importantly to test if the system is vulnerable to known GLSAs.

See man glsa-check and glsa-check --help for more information:

user $glsa-check --help
usage: glsa-check <option> [glsa-id | all | new | affected]
optional arguments:
  -h, --help        show this help message and exit
  -V, --version     Show information about glsa-check
  -q, --quiet       Be less verbose and do not send empty mail
  -v, --verbose     Print more messages
  -n, --nocolor     Removes color from output
  -e, --emergelike  Upgrade to latest version (not least-change)
  -c, --cve         Show CVE IDs in listing mode
  -r, --reverse     List GLSAs in reverse order
  -l, --list        List a summary for the given GLSA(s) or set and whether they affect the system
  -d, --dump        Show all information about the GLSA(s) or set
  --print           Alias for --dump
  -t, --test        Test if this system is affected by the GLSA(s) or set and output the GLSA ID(s)
  -p, --pretend     Show the necessary steps to remediate the system
  -f, --fix         (experimental) Attempt to remediate the system based on the instructions given in the GLSA(s) or set. This will only upgrade (when an upgrade path exists) or remove packages
  -i, --inject      Inject the given GLSA(s) into the glsa_injected file
  -m, --mail        Send a mail with the given GLSAs to the administrator
glsa-list can contain an arbitrary number of GLSA ids, filenames containing GLSAs or the special identifiers 'all' and 'affected'


Main (Gentoo) ebuild repository sync time

To see when the Gentoo ebuild repository was last updated (synced), run the following command:

user $cat /var/db/repos/gentoo/metadata/timestamp.chk


Corrupt or absent Portage

Although it should be very rare, as with all data, there remains a possibility that Portage could become corrupt or even uninstalled, which would be very bad for the functioning of the whole system. If ever this were to occur, there are ways Portage can be recovered, however, because Portage is so central, re-installation is a rather involved operation, requiring manual intervention to, in effect, install a package manager without having a functioning package manager.

See Fix my Gentoo for details on emergency installation via binary packages. See also Fixing broken Portage.

Default Gentoo ebuild repository location change

As of portage v2.3.66[1], which was released on 2019-04-29[2], the default locations changed for the portdir, distdir, repo_name, repo_basedir directories.

For more information see bug bug #662982.

Old location

CÓDIGO Location before 2019-04-29

New location

CÓDIGO Location as of 2019-04-29 and later

See also

  • /etc/portage — the primary configuration directory for Portage, Gentoo's package manager.
  • /etc/portage/make.conf — the main configuration file used to customize the Portage environment on a global level., the location Portage keeps binary packages.
  • /etc/portage/color.map — a file containing variables that define color classes used by Portage.
  • prefix — enables the power of Gentoo and Portage on other distributions and/or operating systems (Microsoft Windows via Cygwin, Android via Termux, etc.).

Related to Portage

  • Upgrading Gentoo
  • Creating an ebuild repository — basics of creating an ebuild repository and maintaining ebuilds in it.
  • GCC optimization — una introducción al código compilado de forma óptima usando CFLAGS y CXXFLAGS seguras y sanas
  • Portage tips — the command-line interface to Portage
  • Repository format — A quick reference to Gentoo ebuild repository (overlay) format.
  • Package Manager Specification — a standardization effort to ensure that the ebuild file format, the ebuild repository format (of which the Gentoo ebuild repository is the main incarnation), as well as behavior of the package managers interacting with these ebuilds is properly agreed upon and documented.
  • Ebuild repository — una estructura de directorios y ficheros utilizados para añadir y extender paquetes de software en un sistema basado en Gentoo.
  • Category:Portage
  • Gentoolkit
  • Portage Multi Stage Dockerfile — The emerge --quickpkg-direct and related emerge --quickpkg-direct-root options are useful inside Dockerfiles
  • Portage Security — aims to answer the question "How can I dispel doubts regarding the security of the Gentoo ebuild repository on a system?"
  • Portage TMPDIR on tmpfs — Building packages in tmpfs both speeds up emerge times and reduces HDD/SSD wear.

Portage in the Gentoo AMD64 Handbook

Portage tools

Alternate package managers and GUIs

  • Pkgcore — an alternative package manager for Gentoo that aims for high performance, extensibility, and a clean design.
  • Paludis — a multi-format package manager and an alternative to Portage.
  • app-portage/kuroo - Graphical Portage frontend based on KF5/Qt5.

External resources

Portage man pages

The man pages contain complete technical documentation for Portage. Type man <subject> in a shell on a Gentoo system to read the local man page. Note that man pages have a see also section for further information.