Portage is probably Gentoo's most notable innovation in software management. With its high flexibility and enormous amount of features it is frequently seen as the best software management tool available for Linux.
Portage is completely written in
Most users will work with Portage through the
$ man emerge
When we talk about packages, we often mean software titles that are available to
the Gentoo users through the Portage tree. The Portage tree is a collection of
Whenever you ask Portage to perform some action regarding software titles, it will use the ebuilds on your system as a base. It is therefore important that you regularly update the ebuilds on your system so Portage knows about new software, security updates, etc.
The Portage tree is usually updated with
# emerge --sync
If you are unable to rsync due to firewall restrictions you can still update
your Portage tree by using our daily generated Portage tree snapshots. The
# emerge-webrsync
To search through the Portage tree after software titles, you can use
For instance, to search for all packages who have "pdf" in their name:
$ emerge --search pdf
If you want to search through the descriptions as well you can use the
$ emerge --searchdesc pdf
When you take a look at the output, you'll notice that it gives you a lot of information. The fields are clearly labelled so we won't go further into their meanings:
* net-print/cups-pdf
Latest version available: 1.5.2
Latest version installed: [ Not Installed ]
Size of downloaded files: 15 kB
Homepage: http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/
Description: Provides a virtual printer for CUPS to produce PDF files.
License: GPL-2
Once you've found a software title to your liking, you can easily install it
with
# emerge gnumeric
Since many applications depend on each other, any attempt to install a certain
software package might result in the installation of several dependencies as
well. Don't worry, Portage handles dependencies well. If you want to find out
what Portage
# emerge --pretend gnumeric
When you ask Portage to install a package, it will download the necessary source
code from the internet (if necessary) and store it by default in
# emerge --fetchonly gnumeric
Many packages come with their own documentation. Sometimes, the
(alsa-lib is just an example, of course.) # emerge -vp alsa-lib [ebuild N ] media-libs/alsa-lib-1.0.14_rc1 -debug +doc 698 kB
The best way of enabling the
Once the package installed, its documentation is generally found in a
subdirectory named after the package under the
# ls -l /usr/share/doc/alsa-lib-1.0.14_rc1 total 28 -rw-r--r-- 1 root root 669 May 17 21:54 ChangeLog.gz -rw-r--r-- 1 root root 9373 May 17 21:54 COPYING.gz drwxr-xr-x 2 root root 8560 May 17 21:54 html -rw-r--r-- 1 root root 196 May 17 21:54 TODO.gz(Alternatively, use equery to locate interesting files:) # equery files alsa-lib | less media-libs/alsa-lib-1.0.14_rc1 * Contents of media-libs/alsa-lib-1.0.14_rc1: /usr /usr/bin /usr/bin/alsalisp(Output truncated)
When you want to remove a software package from your system, use
However, a
# emerge --unmerge gnumeric
When you remove a package from your system, the dependencies of that package
that were installed automatically when you installed the software are left. To
have Portage locate all dependencies that can now be removed, use
To keep your system in perfect shape (and not to mention install the latest
security updates) you need to update your system regularly. Since Portage only
checks the ebuilds in your Portage tree you first have to update your Portage
tree. When your Portage tree is updated, you can update your system with
# emerge --update --ask world
Portage will then search for newer version of the applications you have
installed. However, it will only verify the versions for the applications you
have
# emerge --update --deep world
Since security updates also happen in packages you have not explicitly installed on your system (but that are pulled in as dependencies of other programs), it is recommended to run this command once in a while.
If you have altered any of your
# emerge --update --deep --newuse world
Some packages in the Portage tree don't have any real content but are used to
install a collection of packages. For instance, the
If you ever want to remove such a package from your system, running
Portage has the functionality to remove orphaned dependencies as well, but since
the availability of software is dynamically dependent you first need to update
your entire system fully, including the new changes you applied when changing
USE flags. After this you can run
All this is handled with the following three commands:
# emerge --update --deep --newuse world # emerge --depclean # revdep-rebuild
# emerge gentoolkit
As we stated before, Portage is extremely powerful and supports many features that other software management tools lack. To understand this, we explain a few aspects of Portage without going into too much detail.
With Portage different versions of a single package can coexist on a system.
While other distributions tend to name their package to those versions (like
There are also packages that provide the same functionality but are implemented
differently. For instance,
Software in the Portage tree can reside in different branches. By default your system only accepts packages that Gentoo deems stable. Most new software titles, when committed, are added to the testing branch, meaning more testing needs to be done before it is marked as stable. Although you will see the ebuilds for those software in the Portage tree, Portage will not update them before they are placed in the stable branch.
Some software is only available for a few architectures. Or the software doesn't work on the other architectures, or it needs more testing, or the developer that committed the software to the Portage tree is unable to verify if the package works on different architectures.
Each Gentoo installation adheres to a certain
[blocks B ] mail-mta/ssmtp (is blocking mail-mta/postfix-2.2.2-r1)
!!! Error: the mail-mta/postfix package conflicts with another package. !!! both can't be installed on the same system together. !!! Please use 'emerge --pretend' to determine blockers.
Ebuilds contain specific fields that inform Portage about its dependencies.
There are two possible dependencies: build dependencies, declared in
To fix a blockage, you can choose to not install the package or unmerge the
conflicting package first. In the given example, you can opt not to install
You may also see blocking packages with specific atoms, such as <media-video/mplayer-bin-1.0_rc1-r2. In this case, updating to a more recent version of the blocking package would remove the block.
It is also possible that two packages that are yet to be installed are blocking
each other. In this rare case, you should find out why you need to install both.
In most cases you can do with one of the packages alone. If not, please file a
bug on
!!! all ebuilds that could satisfy "bootsplash" have been masked.
!!! possible candidates are: - gnome-base/gnome-2.8.0_pre1 (masked by: ~x86 keyword) - lm-sensors/lm-sensors-2.8.7 (masked by: -sparc keyword) - sys-libs/glibc-2.3.4.20040808 (masked by: -* keyword) - dev-util/cvsd-1.0.2 (masked by: missing keyword) - games-fps/unreal-tournament-451 (masked by: package.mask) - sys-libs/glibc-2.3.2-r11 (masked by: profile)
When you want to install a package that isn't available for your system, you will receive this masking error. You should try installing a different application that is available for your system or wait until the package is put available. There is always a reason why a package is masked:
emerge: there are no ebuilds to satisfy ">=sys-devel/gcc-3.4.2-r4". !!! Problem with ebuild sys-devel/gcc-3.4.2-r2 !!! Possibly a DEPEND/*DEPEND problem.
The application you are trying to install depends on another package that is not
available for your system. Please check
!!! The short ebuild name "aterm" is ambiguous. Please specify
!!! one of the following fully-qualified ebuild names instead:
dev-libs/aterm
x11-terms/aterm
The application you want to install has a name that corresponds with more than one package. You need to supply the category name as well. Portage will inform you of possible matches to choose from.
!!! Error: circular dependencies: ebuild / net-print/cups-1.1.15-r2 depends on ebuild / app-text/ghostscript-7.05.3-r1 ebuild / app-text/ghostscript-7.05.3-r1 depends on ebuild / net-print/cups-1.1.15-r2
Two (or more) packages you want to install depend on each other and can
therefore not be installed. This is most likely a bug in the Portage tree.
Please resync after a while and try again. You can also check
!!! Fetch failed for sys-libs/ncurses-5.4-r5, continuing...(...) !!! Some fetch errors were encountered. Please see above for details.
Portage was unable to download the sources for the given application and will try to continue installing the other applications (if applicable). This failure can be due to a mirror that has not synchronised correctly or because the ebuild points to an incorrect location. The server where the sources reside can also be down for some reason.
Retry after one hour to see if the issue still persists.
!!! Trying to unmerge package(s) in system profile. 'sys-apps/portage' !!! This could be damaging to your system.
You have asked to remove a package that is part of your system's core packages. It is listed in your profile as required and should therefore not be removed from the system.
Sometimes, when you attempt to emerge a package, it will fail with the message:
>>> checking ebuild checksums !!! Digest verification failed:
This is a sign that something is wrong with the Portage tree -- often, it is because a developer may have made a mistake when committing a package to the tree.
When the digest verification fails, do
Instead, wait an hour or two for the tree to settle down. It's likely that the
error was noticed right away, but it can take a little time for the fix to
trickle down the Portage tree. While you're waiting, check
Once you see that the bug has been fixed, you may want to re-sync to pick up the fixed digest.