In the case you somehow do not have Portage (it could have became corrupted or you might have removed it accidentally) there are ways you can recover it. Here are a few viable solutions in order for you to get it (back) on your system:
- Have a friend or build server build Portage binaries for you and then transfer them to your machine (hardest, and most time consuming).
- Manually download a copy of Portage tarball, manually build it, and then manually install it yourself. You will be doing all the work that Portage makes automatic (easier than the first option, and probably would take less time).
- Boot up a LiveDVD/CD that has Portage included (like a Gentoo LiveDVD or SysRescCD) in order to remove and then to reinstall install Portage to your mounted root filesystem (potentially the fastest option in the case that you have a CD/DVD burnt). For example, if the root file system with broken Portage was mounted at /mnt/gentoo the following commands could be used from a live environment.
- First change all of Portage's relevant environment variables to be set to the Portage directory of the mounted root filesystem. If you mounted your broken Portage root directory at /mnt/gentoo the command would look like this:
- Next run the
emergecommand in order to remove any traces of the old broken Portage package:
- You should then sync your Portage tree (in case your system is a bit behind on the current Portage tree):
- Finally install the new version of Portage:
In addition to the official repository (colloquially known as "portage tree" because of its traditional placement in /usr/portage/), there are additional repositories which in Gentoo are called overlays.
Command-line interface: emerge
emerge is the command-line interface to the Portage system. This is how most users will interact with Portage. The
emerge command has many possible options. For a complete list of all options see its man page:
Below you see an exemplary invocation of
emerge. The options (
-atv) are shortcuts for
--verbose. They trigger
emerge to ask before proceeding, display the dependency tree of packages to be installed, and to be verbose with its output. While in the context of Portage, the term "package" can also be referred to as an "atom." Don't be confused if you see the term "atom" used instead of the term "package."
These are the packages that would be merged, in reverse order:
Calculating dependencies... done! [ebuild ] category/package- - [2.0] USE="enabled -disabled toggled new (-unavailable)" MAKE_OPTIONS="-disabled" 777 kB [ebuild U ] -2.0[3.0] 777 kB [ebuild ] category/package-1.0 777 kB [ebuild ] category/package-0.5 777 kB
Total: 4 packages (1 new, 1 reinstall, 1 upgrade, 1 downgrade), Size of downloads: 3108 kBWould you like to merge these packages? [Yes/No]
There are a few GUI interfaces that exist for Portage, although some of them have become unmaintained.
app-portage/porthole: A GTK+-based frontend to Portage.
app-portage/kuroo4: Graphical Portage frontend based on KDE4/Qt4.
Alternatives to Portage
sys-apps/paludis: An alternative package manager written expressly for Gentoo-based systems.
app-arch/dpkg: A package manager for Debian based systems.
sys-apps/yum: The package manager for RPM systems that also can be used on Gentoo.
Relevant Gentoo Wiki pages
- GCC optimization
- Useful portage tools
- Binary package guide
- Portage tips
- /etc/portage configuration files
- Repository format
- PMS (Package Manager Specification)
Related sections of the Gentoo Handbook
- A Portage Introduction
- USE flags
- Portage Features
- Files and Directories
- Configuring through Variables
- Mixing Software Branches
- Additional Portage Tools