MAN emerge 1

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the MAN series.
Purge this man page to update its contents

Contents

[edit] NAME

emerge - Command-line interface to the Portage system

[edit] SYNOPSIS

emerge

[options] [action] [ebuild | tbz2file | class | dependency] ...
emerge

[options] [action] ebuildfile
emerge

sync
emerge

--help -h [system | config | sync]
emerge

--version

[edit] DESCRIPTION

emerge is the definitive command-line interface to the Portage system. It is primarily used for installing packages, and emerge can automatically handle any dependencies that the desired package has. emerge can also update the portage tree, making new and updated packages available. emerge gracefully handles updating installed packages to newer releases as well. It handles both source and binary packages, and it can be used to create binary packages for distribution.

[edit] EBUILDS, TBZ2S, CLASSES AND DEPENDENCIES

emerge primarily installs packages. You can specify packages to install in one of four main ways: an ebuild, a tbz2file, a class, or a dependency.

ebuild
An ebuild must be, at a minimum, a valid Portage package directory name without a version or category, such as portage or python. Both categories and version numbers may be used in addition, such as sys-apps/portage or =python-2.2.1-r2. emerge ignores a trailing slash so that filename completion can be used. The ebuild may also be an actual filename, such as /usr/portage/app-admin/python/python-2.2.1-r2.ebuild.
tbz2file
A tbz2file must be a valid .tbz2 created with ebuild <package>-<version>.ebuild package or emerge --buildpkg [category/]<package> or quickpkg /var/db/pkg/<category>/<package>.
class
Package classes are a convenient shorthand for large groups of packages. Two classes are currently supported: system and world. system refers to a set of packages deemed necessary for your system to run properly. world contains all of the packages in system, along with any other packages listed in /var/cache/edb/world. [See FILES below for more information.] Note that these commands are generally used in conjunction with --update.
dependency
A dependency describes bounds on a package that you wish to install. For example, >=dev-lang/python-2.2.1-r2 matches the latest available version of Python greater than or equal to 2.2.1-r2. Similarly, <dev-lang/python-2.0 matches the latest available version of Python before 2.0. Note that in many shells you will need to escape characters such as '<' and '='; use single- or double-quotes around the dependency to get around escaping problems.

[edit] ACTIONS

No action

If no action is specified, the action is to merge in the specified packages, satisfying any dependencies that they may have. The arguments can be ebuilds, tbz2s, classes, or dependencies. Note that you need to use the --usepkg option if you want to install a tbz2. The packages are added to the world file at the end, so that they are considered for later updating.
clean (-c)

Cleans the system by removing packages that will not effect the functionality of the system. The arguments can be ebuilds, classes, or dependencies. For example, emerge clean binutils cleans out old versions of binutils; emerge clean net-www/mozilla-0.9.9-r2 cleans out that specific version of Mozilla. This is generally safe to use. Note that clean does not remove unslotted packages.
depclean

Determines all packages installed on the system that have no explicit reason for being there. emerge generates a list of packages which it expects to be installed by checking the system package list and the world file. It then compares that list to the list of packages which are actually installed; the differences are listed as unnecessary packages and are suggested for unmerging. WARNING: Removing some packages may cause packages which link to the removed package to stop working and complain about missing libraries. Re-emerge the complaining package to fix this issue. Note that changes in USE flags can drastically affect the output of depclean.
help (-h)

Displays help information for emerge. Adding one of the additional arguments listed above will give you more specific help information on that subject. The internal emerge help documentation is updated more frequently than this man page; check it out if you are having problems that this man page does not help resolve.
info

This is a list of information to include in bug reports which aids the developers with fixing any problems you may report. Please include this information when submitting a bug report. Expanded output can be obtained with the --verbose option.
inject (-i)

Injecting a package inserts a 'stub' for that package so that Portage thinks that it is installed. It is handy if you need, say, a binary version of XFree86 for esoteric hardware, or you just like to roll your own packages. You must specify a category and particular version of a package for injecting. For example, emerge inject sys-kernel/gentoo-sources-2.4.19.
prune (-P)

WARNING: This action can remove important packages! Removes all but the latest versions of matching packages. If there are multiple SLOTs for a package, it leaves the latest version in each SLOT. This does no checking of dependencies, so it may remove packages necessary for the proper operation of your system. Use clean instead unless you really know what you're doing. Its arguments can be ebuilds, classes, or dependencies -- see clean above for examples.
regen

Causes portage to check and update the dependency cache of all ebuilds in the portage tree. The cache is used to speed up searches and the building of dependency trees. This command is not recommended for rsync users as rsync updates the cache using server-side caches. If you do not know the differences between a 'rsync user' and some other user, then you are a 'rsync user' :). Rsync users should simply run emerge sync to regenerate the cache.
search (-s)

Searches for matches of the supplied string in the portage tree. The search string is a regular expression. For example, emerge search "^kde" searches for any package that starts with "kde"; emerge search "gcc$" searches for any package that ends with "gcc"; emerge search "office" searches for any package that contains the word "office". If you want to search the package descriptions as well, use the --searchdesc option.
sync

Initiates a portage tree update with one of the rsync.gentoo.org mirrors. Note that any changes you have made to the portage tree will be erased. Except for in special circumstances, this uses rsync to do the update. See make.conf(5)'s description of PORTDIR_OVERLAY for a method to avoid deletions.
unmerge (-C)

WARNING: This action can remove important packages! Removes all matching packages. This does no checking of dependencies, so it may remove packages necessary for the proper operation of your system. Its arguments can be ebuilds, classes, or dependencies -- see clean above for examples.

[edit] OPTIONS

--ask (-a)

Before performing the merge, display what ebuilds and tbz2s will be installed, in the same format as when using --pretend; then ask whether to continue with the merge or abort. Using --ask is more efficient than using --pretend and then executing the same command without --pretend, as dependencies will only need to be calculated once.
--buildpkg (-b)

Tells emerge to build binary packages for all ebuilds processed in addition to actually merging the packages. Useful for maintainers or if you administrate multiple Gentoo Linux systems (build once, emerge tbz2s everywhere). The package will be created in the ${PKGDIR}/All directory. An alternative for already-merged packages is to use quickpkg which creates a tbz2 from the live filesystem.
--buildpkgonly (-B)

Creates binary packages for all ebuilds processed without actually merging the packages. This comes with the caveat that all build time dependencies must already be emerged on the system.
--changelog (-l)

Use this in conjunction with the --pretend action. This will show the ChangeLog entries for all the packages that will be upgraded.
--columns

Used along side --pretend to causes the package, new version, and old version to be displayed in an aligned format for easy cut-n-paste.
--debug (-d)

Tells emerge to run the emerge command in --debug mode. In this mode the bash build environment will run with the -x option, causing it to output verbose debug information to stdout. --debug is great for finding bash syntax errors.
--deep (-D)

When used in conjunction with --update, this flag forces emerge to consider the entire dependency tree of packages, instead of checking only the immediate dependencies of the packages. As an example, this catches updates in libraries that are not directly listed in the dependencies of a package.
--emptytree (-e)

Virtually tweaks the tree of installed packages to only contain glibc; this is great to use together with --pretend. This allows developers to get a complete overview of the complete dependency tree of a package, and it enables complete trees to be rebuilt using the latest libraries.
--fetchonly (-f)

Instead of doing any package building, just perform fetches for all packages (the main package as well as all dependencies.)
--noconfmem

Causes portage to disregard merge records indicating that a config file inside of a CONFIG_PROTECT directory has been merged already. Portage will normally merge those files only once to prevent the user from dealing with the same config multiple times. This flag will cause the file to always be merged.
--nodeps (-O)

Merges specified packages without merging any dependencies. Note that the build may fail if the dependencies aren't satisfied.
--noreplace (-n)

Skips the packages specified on the command-line that have already been installed. Without this option, any packages, ebuilds, or deps you specify on on the command-line *will* cause Portage to remerge the package, even if it is already installed. Note that Portage will not remerge dependencies by default.
--nospinner

Disables the spinner for the session. The spinner is active when the terminal device is determined to be a TTY. This flag disables it regardless.
--oneshot

Emerge as normal, but do not add the packages to the world profile for later updating.
--onlydeps (-o)

Only merge (or pretend to merge) the dependencies of the packages specified, not the packages themselves.
--pretend (-p)

Instead of actually performing the merge, simply display what *would* have been installed if --pretend weren't used. Using --pretend is strongly recommended before installing an unfamiliar package. In the printout, N = new, U = upgrading, R = replacing, F = fetch restricted, B = blocked by an already installed package.
--quiet (-q)

Results may vary, but the general outcome is a reduced or condensed output from portage's displays.
--resume

Resumes the last merge operation. Please note that this operation will only return an error on failure. If there is nothing for portage to do, then portage will exit with a message and a success condition.
--searchdesc (-S)

Matches the search string against the description field as well as the package name. Take caution as the descriptions are also matched as regular expressions.
--skipfirst

This action is only valid when used with --resume. It removes the first package in the resume list so that a merge may continue in the presence of an uncorrectable or inconsequential error. This should only be used in cases where skipping the package will not result in failed dependencies.
--update (-u)

Updates packages to the most recent version available. Note that --update does not have full functionality yet. It will not automatically update dependencies of packages in the world file, unless they too are in the world file.
--upgradeonly (-U)

Updates packages, but excludes updates that would result in a lower version of the package being installed. SLOTs are considered at a basic level.
--usepkg (-k)

Tells emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time-consuming compiles. This option is useful for CD installs; you can export PKGDIR=/mnt/cdrom/packages and then use this option to have emerge "pull" binary packages from the CD in order to satisfy dependencies.
--usepkgonly (-K)

Behaves just as --usepkg except that this will only emerge binary packages. All the binary packages must be available at the time of dependency calculation or emerge will simply abort.
--verbose (-v)

Tell emerge to run in verbose mode. Currently this flag causes emerge to print out GNU info errors, if any, and to show the USE flags that will be used for each package when pretending.
--version (-V)

Displays the version number of emerge. It cannot be used in conjunction with other options; the name and format of the action is a convention.

[edit] ENVIRONMENT OPTIONS

ROOT = [path]
Use ROOT to specify the target root filesystem to be used for merging packages or ebuilds. Defaults to /.

[edit] OUTPUT

While utilizing emerge and the pretend/verbose flags, the output may be a little hard to understand for the first time. This section exists to explain what the shorthanded information means.

[blocks B ] app-text/dos2unix (from pkg app-text/hd2u-0.8.0)

Dos2unix is Blocking hd2u from being emerged. Blockers are defined when two packages will clobber each others files, or otherwise cause some form of breakage in your system. However, blockers usually do not need to be simultaneously emerged because they usually provide the same functionality.
[ebuild N ] app-games/qstat-25c
Qstat is New to your system, and will be emerged for the first time.
[ebuild S ] dev-libs/glib-2.4.7
You already have a version of glib installed, but a 'new' version in a different SLOT is available.
[ebuild R ] sys-apps/sed-4.0.5
Sed 4.0.5 has already been emerged, but if you run the command, then portage will Re-emerge the specified package (sed in this case).

[ebuild F ] media-video/realplayer-8-r6
The realplayer package requires that you download the sources manually. When you attempt to emerge the package, if the sources are not found, then portage will halt and you will be provided with instructions on how to download the required files.
[ebuild U ] net-fs/samba-2.2.8_pre1 [2.2.7a]

Samba 2.2.7a has already been emerged and can be Updated to version 2.2.8_pre1.
[ebuild UD] media-libs/libgd-1.8.4 [2.0.11]

Libgd 2.0.11 is already emerged, but if you run the command, then portage will Downgrade to version 1.8.4 for you.

This may occur if a newer version of a package has been masked because it is broken or it creates a security risk on your system and a fix has not been released yet.

Another reason this may occur is if a package you are trying to emerge requires an older version of a package in order to emerge succesfully. In this case, libgd 2.x is incompatible with libgd 1.x. This means that packages that were created with libgd 1.x will not compile with 2.x and must downgrade libgd first before they can emerge.

[ebuild U-] x11-base/xfree-4.3.0 [4.2.99.902]

The - represents lack of SLOT information about Xfree. This will occur when the previous version emerged was injected (see inject for more info) or very outdated (so old that SLOT did not exist). Either way, a newer version of Xfree is availabe for your updating delight.
[ebuild U ] net-analyzer/nmap-3.15_beta2 [3.15_beta1] -gtk -gnome

The -gtk and -gnome reflect the status of USE variables when emerging nmap. Here we see that nmap can use the USE variables gtk and gnome, but that your current settings have gtk and gnome disabled. So optional support for gtk and gnome will not be enabled in nmap when you emerge it.

*Note: The USE status is only displayed when you use the --verbose option along with the --pretend or --ask options.

[edit] NOTES

You should almost always precede any package install or update attempt with either a --ask or --pretend install or update. This lets you see how much will be done, and shows you any blocking packages that you will have to rectify. This goes doubly so for the system and world classes, which can update a large number of packages if the portage tree has been particularly active.

It is better to use the --ask flag instead of the --pretend flag as this is more efficient due to it calculating the dependancies once and asking you if you wish to continue with the emerge. With use of --pretend, portage checks for dependancies twice. Once when you are checking the packages (i.e.: emerge --pretend --verbose xfree), then again when you emerge the package (i.e.: emerge xfree).

You also want to typically use --update, which ignores packages that are already fully updated but upgrades those that are not.

When you install a package with uninstalled dependencies and do not explicitly state those dependencies in the list of parameters, they will not be added to the world file. If you want them to be detected for world updates, make sure to explicitly list them as parameters to emerge.

USE variables may be specified on the command line to override those specified in the default locations, letting you avoid using some dependencies you may not want to have. USE flags specified on the command line are NOT remembered. For example, USE="-x -gnome" emerge mc will emerge mc with those USE settings.

If emerge --update system or emerge --update world fail with an error message, it may be that an ebuild uses some newer feature not present in this version of emerge. You can use emerge --update portage to upgrade to the lastest version, which should support any necessary new features.

[edit] MASKED PACKAGES

NOTE: Please use caution when using development packages. Problems and bugs resulting from misusing masked packages drains Gentoo developer time. Please be sure you are capable of handling problems that may ensue. <P>

Masks in portage provide three primary functions: they allow a testing period where the packages can be used in live machines; they prevent the use of a package when it will fail, and they mask existing packages that are broken or could pose a security risk. Masking can be done by two methods: package.mask and KEYWORDS. Read below to find out how to unmask in either case. Also note that if you give emerge an ebuild then all forms of masking will be ignored and emerge will attempt to emerge the package.

package.mask

package.mask primarily blocks the use of packages that cause problems or are known to have issues on disparate systems. It resides in ${PORTDIR}/profiles. Packages may be unmasked in the file by adding a comment character (#) to the beginning of the line which masks the package.
KEYWORDS

KEYWORDS are also used for masking packages still in testing. There are architecture-specific keywords for each package that let portage know which systems are compatible with the package. Packages which compile on an architecture, but have not been proven to be "stable", are masked with a tilde (~) in front of the architecture name. emerge examines the ACCEPT_KEYWORDS environment variable to allow or disallow the emerging of a package masked by KEYWORDS. To inform emerge that it should build these 'testing' versions of packages, you may set ACCEPT_KEYWORDS to "~arch", where arch is one of: x86 amd64 ppc sparc mips alpha arm hppa. For example, ACCEPT_KEYWORDS="~x86" emerge xfree will cause emerge to consider KEYWORDS-masked versions of XFree as potentional upgrade canidates. WARNING: Do not set this variable to anything other than the value corresponding to your architecture.

[edit] REPORTING BUGS

Please report any bugs you encounter through our website:

http://bugs.gentoo.org/

Please include the output of emerge info when you submit your bug report.

[edit] SEE ALSO

emerge --help, make.conf

A number of helper applications reside in /usr/lib/portage/bin.

The app-admin/gentoolkit package contains useful scripts such as qpkg (a package query tool).

[edit] FILES

/var/cache/edb/world
Contains a list of all user-specified packages. You can safely edit this file, adding packages that you want to be considered in world class updates and removing those that you do not want to be considered. In newer testing versions of portage you find the world file in /var/lib/portage/world
/etc/make.conf
Contains variables for the build process, overriding those in make.globals. You should edit this file instead of the ones listed below.
/etc/dispatch-conf.conf

Contains settings to handle automatic updates/backups of configuration files.
/etc/make.profile/make.defaults
Contains profile-specific variables for the build process. Do not edit this file.
/etc/make.profile/use.defaults
Contains a list of packages which, if installed, cause the respective use flag to be enabled by default. Do not edit this file.
/usr/portage/profiles/use.desc
Contains the master list of USE flags with descriptions of their functions. Do not edit this file.
/etc/make.profile/virtuals
Contains a list of default packages used to resolve virtual dependencies. Do not edit this file.
/var/cache/edb/virtuals
Contains a list of packages used to resolve virtual dependencies. In the case of failing virtual matches, you may reorder the entries for the corresponding virtual here. The first package listed after the virtual is the entry used for matching the virtual.
/etc/make.profile/package
Contains a list of packages used for the base system. The system and world classes consult this file. Do not edit this file.
/etc/make.globals
Contains the default variables for the build process. Do not edit this file.

[edit] AUTHORS

Daniel Robbins <drobbins@gentoo.org>
Geert Bevin <gbevin@gentoo.org>
Achim Gottinger <achim@gentoo.org>
Nicholas Jones <carpaski@gentoo.org>
Phil Bordelon <sunflare@gentoo.org>
Mike Frysinger <vapier@gentoo.org>

[edit] CVS HEADER

$Id: emerge.1,v 1.48 2004/02/09 16:38:36 vapier Exp $

Personal tools
In other languages