Emerge
emerge — configuration — ebuild repository — dispatch-conf
world file — USE flags — ebuilds — profiles
upgrades — using testing packages — binary packages
tools — gentoolkit — eselect
Portage FAQ — cheat sheet — FAQ
all articles
emerge est la principale interface en ligne de commande de Portage, le gestionnaire de paquets de Gentoo.
emerge est utilisé pour télécharger, installer, mettre à jour et maintenir le socle des logiciels sur Gentoo Linux.
emerge est une commande très puissante et flexible, qui peut, entre autre, automatiquement construire et installer des paquets " depuis leur source ", récupérer et installer des paquets binaires " prêt-à-l'emploi ", créer des paquets binaires, chercher des paquets, rapporter des informations systèmes, etc.
La commande emerge a beaucoup d'options disponibles. Pour une documentation étendue et complète de la liste des options voir man emerge.
Voir l'article sur Portage pour l'utilisation de Portage au-delà de la commande emerge.
Les chapitres travailler avec Gentoo et utiliser Portage du Manuel ont des sections autour de l'usage de la commande emerge.
Quelques questions courantes à propos de la commande emerge sont répondues dans la FAQ et dans la FAQ de Portage.
Utilisation
Invocation
La commande emerge doit être suivit d'options appropriées, d'actions et de paquets ou séries de paquets. Si emerge est invoqué sans aucun paramètres ou paquets, il affichera son aide textuelle et s'arrêtera.
Pour la plupart des usages emerge doit être invoqué avec les privilèges super-utilisateur, cependant pour simplement récupérer des informations il est possible de l'exécuter avec des privilèges de non super-utilisateur.
Si emerge est invoqué avec un paquet et sans autres options, il tentera immédiatement d'installer le paquet correspondant sans demander de confirmations à l'utilisateur. Cela est parfois un fonctionnement non-désiré, alors l'une des options suivantes sera probablement requise.
Les options --ask
(-a
) et --pretend
(-p
) autorisent l'examen du changement prévu dans le système avant qu'elles ne soient effectivement réalisées. L'option --ask
fera afficher à emerge les changements prévus et demandera la confirmation avant de continuer. L'option --pretend
vas simplement afficher les changements prévus et s'arrêtera et ne requiert aucun privilèges super-utilisateur.
When using the
--ask
option, an accidental press of the Enter key during processing will result in the confirmation prompt being skipped. See the --ask
option section of man emerge for more information.emerge provides rich output, with information and warnings about individual packages and the system as a whole. The --verbose
option is useful to have Portage show even more information, such as what USE flags will be used to install or update a package, what USE flags are available for each package, the size of the package download, etc.
Running emerge with the --help
option provides information on command line options:
user $
emerge --help
emerge: command-line interface to the Portage system Usage: emerge [ options ] [ action ] [ ebuild | tbz2 | file | @set | atom ] [ ... ] emerge [ options ] [ action ] < @system | @world > emerge < --sync | --metadata | --info > emerge --resume [ --pretend | --ask | --skipfirst ] emerge --help Options: -[abBcCdDefgGhjkKlnNoOpPqrsStuUvVwW] [ --color < y | n > ] [ --columns ] [ --complete-graph ] [ --deep ] [ --jobs JOBS ] [ --keep-going ] [ --load-average LOAD ] [ --newrepo ] [ --newuse ] [ --noconfmem ] [ --nospinner ] [ --oneshot ] [ --onlydeps ] [ --quiet-build [ y | n ] ] [ --reinstall changed-use ] [ --with-bdeps < y | n > ] Actions: [ --depclean | --list-sets | --search | --sync | --version ] For more help consult the man page.
Below is an example invocation of emerge, installing "package". The options -atv
are short options for --ask
(see above), --tree
(display the dependency tree of packages to be installed), and --verbose
(see above). Hover the mouse cursor over the red dotted boxes to see an explanation of each section of output:
These are the packages that would be merged, in reverse order:
Calculating dependencies... done! [ebuild U ] category/package-3.0-r2 [2.0] USE="enabled -disabled toggled* new% (-unavailable)" MAKE_OPTIONS="-disabled" 777 kB [ebuild UD ] category/package-2.0 [3.0] 777 kB [ebuild R ] category/package-1.0 777 kB [ebuild N ] category/package-0.5 777 kB
Total: 4 packages (1 new, 1 reinstall, 1 upgrade, 1 downgrade), Size of downloads: 3108 kB
Would you like to merge these packages? [Yes/No]The U symbol shows a package that will be upgraded, D a package that will be downgraded, R re-emerged, N a new package. In square brackets is the version of the previously installed package. Packages present in the world file are shown in bold - these are the user-installed packages, the other packages will be dependencies, or from the system set.
See the OUTPUT section, and
--pretend
option, of the emerge man page for complete explanation of how to read Portage output.In the context of Portage, the term "package" can have a similar meaning to "atom", see version specifier.
Install a package
Install the net-proxy/tinyproxy package with --ask
and --verbose
options:
root #
emerge --ask --verbose net-proxy/tinyproxy
What package, version, and slot, to install, and from which ebuild repository is indicated using a version specifier.
The
--ask
(-a
) option is very useful, it will allow the emerge actions to be reviewed before the actual operation begins. The --verbose
(-v
) option will show more detailed information about what Portage will do, and is often helpful. Options can be set as default, if desired. Default options can be overridden on the command line, for example --ask=n
.If the
--ask
option is not provided, requested actions will be performed without ever asking for confirmation. The --pretend
option may also be used.Some things, such as dependencies, should not be installed in this way. See do not add dependencies to the world file section.
Package functionality is governed at install time by USE flags which can be set or unset depending on the intended use of a piece of software.
Search for packages
The emerge command's built-in search function described here may show limited results compared to other tools. The Latest version available is constrained by ACCEPT_KEYWORDS (derived from the current profile, make.conf, package.accept_keywords, etc.). In addition, the Latest version available and the Latest installed version are not slot-aware, so they will not show multiple versions by slot. This can lead to some confusion when tools like eix or eshowkw might show more results than emerge --search.
See also eix, equery, and packages.gentoo.org for more advanced ways to search for packages.
Search for packages with proxy in their names:
user $
emerge --search proxy
Search for packages with proxy in their names or description:
user $
emerge --searchdesc proxy
Search packages using a regular expression:
user $
emerge -s '%^python$'
List all packages in a category:
user $
emerge -s '@net-ftp'
Remove (uninstall) packages
Remove the net-proxy/tinyproxy package using the dependency sensitive --depclean
(-c
) option:
root #
emerge --ask --verbose --depclean net-proxy/tinyproxy
This should only remove packages that are not needed as a dependency of a currently installed package.
An alternative to using --depclean
to uninstall packages, is to use emerge --deselect (or -W
option), then cleaning out orphaned packages, as described in the following section.
Do not confuse the lower case
-c
switch, which is short for --depclean
(and is safe), with the upper case -C
switch which risks damaging the system and should only be used when absolutely required (see warning below).Do not use the
--unmerge
(-C
) option (unless its particular behavior is known to be specifically required). This option will remove important packages that are needed for the system to function, without warning.Cleaning out orphaned packages
See remove orphaned packages for information on how to use emerge --depclean to remove potentially unused packages. See also the Portage FAQ.
Update packages
See Upgrading Gentoo for how to update packages.
Get system information
emerge can print system information that can be useful for troubleshooting. This information is often required to be posted when asking for support, or when filing a bug.
user $
emerge --info
Extra information may be output by using the --verbose
flag.
Tips
Verifying and (re)downloading distfiles
To re-verify the integrity of and re-download previously removed/corrupted distfiles for all currently installed packages, run:
root #
emerge --ask --fetchonly --emptytree @world
Do not add dependencies to the world file
If a dependency must be reinstalled, use the --oneshot
option. Installing dependencies with the emerge package command would add them to the world file and may lead to issues.
Installing dependencies with Portage for compiling custom source software is also ill advised: it is preferable to write an ebuild.
See User:Sam/Portage help/Maintaining a Gentoo_system for more information.
Resume emerge
If an emerge of several packages is interrupted (e.g. ctrl+c, crash...), the emerge may be resumed from the failed package with the --resume
option. The --keep-going
and --skipfirst
options may also be of interest. See the emerge man page for details.
Passing temporary configuration to Portage through environment variables
Passing environment variables to Portage on the command line will only result in temporary changes to system configuration, and all such changes will be reverted by routine maintenance, such as a system update. Though this section can be useful for previewing the effects of configuration changes, with the
--pretend
option, it should not be used when actually installing or updating packages.
The emerge command can be passed temporary configuration values by declaring environment variables on the command line, in order to affect behavior for that invocation alone. For example, to merge app-editors/emacs with the svg USE flag enabled, but not make this USE flag setting permanent:
root #
USE='svg' emerge app-editors/emacs
Or to pass extra configuration options to packages that use the econf
function in their ebuild:
root #
EXTRA_ECONF='--without-compress-install' emerge app-editors/emacs
{{{1}}}
re-emerging a package that provided a specific File
Sometimes it is useful to be able to re-emerge a package simply by specifying a particular file that was provided by that package.
As an example, if the user wants to reinstall /usr/lib/libunwind.a but it is not known which package provided this file, the package from where that file came can be determined by emerge by simply indicating the file path:
user $
emerge -p /usr/lib/libunwind.a
These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 2.76 s (backtrack: 0/20). [ebuild R ] sys-libs/llvm-libunwind-17.0.6
Only files that have been provided by a currently-installed package may be re-emerged in this way. See Pfl for other ways to find what packages files might "belong" to.
Troubleshooting
See User:Sam/Portage help for topics on Portage issues.
Emerging packages fail during 'unpack' stage
The following message can occur when emerging packages:
* Error messages for package dev-libs/libinput-1.16.0: * The ebuild phase 'unpack' has exited unexpectedly. This type of behavior * is known to be triggered by things such as failed variable assignments * (bug #190128) or bad substitution errors (bug #200313). Normally, before * exiting, bash should have displayed an error message above. If bash did * not produce an error message above, it's possible that the ebuild has * called `exit` when it should have called `die` instead. This behavior * may also be triggered by a corrupt bash binary or a hardware problem * such as memory or cpu malfunction. If the problem is not reproducible or * it appears to occur randomly, then it is likely to be triggered by a * hardware problem. If you suspect a hardware problem then you should try * some basic hardware diagnostics such as memtest. Please do not report * this as a bug unless it is consistently reproducible and you are sure * that your bash binary and hardware are functioning properly.
Although this issue may be due to the reasons listed in the output above, it can often be caused by low disk space in the path used by Portage to unpack the ebuild's source files. This location is set via the PORTAGE_TMPDIR variable and can be quickly found by querying Portage:
user $
portageq envvar PORTAGE_TMPDIR
/var/tmp
The df command may be used to view available disk space for the partition where PORTAGE_TMPDIR has been mounted (this will likely be the root (/) partition). See Freeing disk space for details on how to free up disk space.
See also
- dispatch-conf — un utilitaire inclus dans Portage, utilisé pour gérer de manière sûre et pratique les fichiers de configuration après les mises à jour de paquets.
- Portage — gestionnaire de paquet et le système de distribution officiel de Gentoo.