Gentoolkit is a suite of tools to ease the administration of a Gentoo system. This document covers the basics of some of the tools present in Gentoolkit.
- 1 Introduction
- 2 equery
- 2.1 Introduction
- 2.2 Finding the Package That a File Came From with belongs (b)
- 2.3 Viewing ChangeLog Entries with changes (c)
- 2.4 Verifying Package Integrity with check (k)
- 2.5 Listing All Packages Depending on Package X with depends (d)
- 2.6 Getting Dependency Graphs with depgraph (g)
- 2.7 Listing Files Installed by a Package with files (f)
- 2.8 Looking for Packages that Have a Specific USE Flag with hasuse (h)
- 2.9 Listing Packages with list (l)
- 2.10 Viewing Package Metadata with meta (m)
- 2.11 Finding Package Sizes with size (s)
- 2.12 Listing Per-Package USE Flags with uses (u)
- 2.13 Finding the Ebuild Path with which (w)
- 3 euse
- 4 Other tools
- 5 Acknowledgements
What is Gentoolkit?
Gentoo is a unique distribution and presents some complexities that simply don't exist for other distributions. As Gentoo developers and contributors discovered some of these complexities, they also wrote tools to help users and administrators work around them. Many of these tools have been contributed to the Gentoo project and are included in the package
Gentoolkit contains a whole bunch of useful tools to help manage your packages and keep track of what is going on in your system. Most users -- particularly those who update systems often -- will benefit from having gentoolkit installed.
Just as with any Gentoo package, installation is just a simple emerge.
Any documentation that a program might have (other than man pages) is stored in /usr/share/doc/gentoolkit-[version]/[program-name]/.
equery is a tool that displays useful information about the packages on your system.
equery is based on a system of modules. Every module has a shorthand name. For example,
equery l gcc is the same a s
equery list gcc.
equery --help explains global options and lists all available modules and their shorthand names.
equery --help module will display the help screen for a specific module. Lastly,
man equery provides a detailed explanation of all available modules and options, and provides useful examples.
Below is a list of features that work over the majority of modules.
Like emerge, equery doesn't understand partial package names:
Unlike emerge, equery can accept shell-like globbing in the category and/or package name:
Most equery modules take multiple input:
A few modules also allow full regular expressions:
The next few sections in this document give a quick introduction to the different
Finding the Package That a File Came From with belongs (b)
belongs can search for files matching a regular expression with the
-f option. The
-e option stops searching after it finds a match. Since no file on your system should be owned by two packages, this is a safe optimization.
Viewing ChangeLog Entries with changes (c)
changes lets you view ChangeLog entries for a package version or range of versions. Imagine after an
emerge --sync, you notice Portage is going to be upgraded and want to check what has changed:
Verifying Package Integrity with check (k)
Sometimes it is useful to check a package's integrity.
equery can verify MD5 sums as well as timestamps to indicate when a package might have been corrupted, replaced, or removed.
Listing All Packages Depending on Package X with depends (d)
Ever wonder why a certain package has been installed on your system?
equery can tell which packages list it as a dependency with
depends. Include indirect dependencies with the
Getting Dependency Graphs with depgraph (g)
depgraph is the opposite of
depends. You pass it a package, and it will find the packages it depends on (not that depend on it). When it finds a dependency, it will recursively search for all of that package's dependencies. Control how deep the tree gets with the
jre is a direct dependency and
jdk is an indirect dependency if the
java USE flag is set.
Listing Files Installed by a Package with files (f)
equery can list all the files installed by an ebuild with the
files module. Try
--tree to get an easy to read directory layout. Use
--filter to only find a certain type of file. For example, to find where executables were installed, use
--filter=cmd, and to quickly find the configuration file location, try
Looking for Packages that Have a Specific USE Flag with hasuse (h)
You can use
hasuse to find out which packages have a given USE flag.
hasuse won't tell you if the flag is enabled, only if the ebuild lists it as an option. See the EXAMPLES section of
hasuse in the
equery man page for more tip on getting that information.
Listing Packages with list (l)
list is a simple, yet powerful module to list packages that are installed, in the Portage tree or in an overlay.
The standard query will search installed packages for the given package name. Passing in '*' displays all packages in the set. In the leftmost field, we see that all the above packages are
I(nstalled) and from the
P(ortage) tree. They're not masked (the second field is blank), and they're all installed in the default slot (0).
This time we are going to use local options to look for packages in the Portage tree and overlays.
In this example you can see version 7.2.182 is installed and there are no versions available from an overlay. You can see which versions are keyword masked by the
~ in the second field.
Viewing Package Metadata with meta (m)
Each package in the Portage tree provides at least some metadata about its maintainer, herd, etc. Read about Gentoo Metadata. The amount of useful information depends on how much package maintainers decide to provide. With no options,
meta returns some basic useful information.
When the maintainer provides extra information, it can be very useful:
Finding Package Sizes with size (s)
Have you ever been curious to find out how much space a specific package is occupying? Since a package could have its files over a number of directories, the usual
du -hc might not give you the correct figure. Not to worry, here comes
equery to the rescue!
As you can see,
size prints the total space used in human-readable units and lists the total number of files the package has. To get the total size in bytes, use
Listing Per-Package USE Flags with uses (u)
uses module can provide information about what USE flags are available for a specific package, and which of those flags is currently enabled.
Here, a number of USE flags are enabled in
gstreamer's plugin meta-package, but you can see that there are other USE flags available. For more information on USE flags, please refer to the USE Flags chapter of the Gentoo Handbook.
Finding the Ebuild Path with which (w)
which is a simple script to help you quickly find the file path to an ebuild. If you pass an unversioned package name,
which will return the path to the newest installable ebuild version, in other words, the ebuild Portage would use if you typed
emerge package. Pass in a versioned package to get the path to that ebuild.
Lastly, if none of the above features of
equery have answered your question, try using
which to manually search an ebuild with programs like
euse is a tool to see, set and unset USE flags at various places. For more information on USE flags, please refer to the USE Flags. Please see
euse -h for complete help and all options.
Viewing, Setting and Unsetting USE Flags
euse -a command reads the current active USE flags and displays them.
Similarly you can use the
euse -a -g command to only view active global USE flags. The
euse -a -l command does the same for active local USE flags.
-l are suboptions to
euse and need an option before them (like
-a) to function correctly.
We can also use
euse to set or unset use flags. The commands used for this are
euse -E flagname (enable a flag) and
euse -D flagname (disable a flag).
Enabling a USE Flag:
The /etc/portage/make.conf file looks like so after the command was ran:
Disabling the USE Flag:
Again, the /etc/portage/make.conf file after the command:
This tool is Gentoo's Reverse Dependency rebuilder. It will scan your installed ebuilds to find packages that have become broken as a result of an upgrade of a package they depend on. It can emerge those packages for you but it can also happen that a given package does not work any more with the currently installed dependencies, in which case you should upgrade the broken package to a more recent version. revdep-rebuild will pass flags to emerge which lets you use the
--pretend flag to see what is going to be emerged again before you go any further.
If you need to rebuild some packages, you may run
revdep-rebuild without the
-p flag and the listed packages will be emerged again.
glsa-check is mainly a test tool that keeps track of the various GLSA's (Gentoo Linux Security Advisory) and will eventually be integrated into
eread is a simple utility to display elog files produced by >=
portage-2.1. You can set the saving of elog files by setting a couple of variables in /etc/portage/make.conf:
Once you've set up elog to your satisfaction, just run
eread to view your log files.
Select a number and the file will be displayed using the paging program specified in the PAGER environment variable. If PAGER is not set, it will use
less. The PAGER environmental variable can be set using
After displaying the elog item, you will be prompted if you want to delete the file.
eclean is a tool to remove old source files and old binary packages from your system.
When you build and install packages, the source files are downloaded and preserved in DISTDIR, usually /usr/portage/distfiles. This can accumulate several gigabytes of material over time if you don't clean it periodically. You can run
eclean-dist to clean only source files from DISTDIR.
You can create archives of installed packages by using
quickpg or FEATURES="buildpkg". These archived packages are kept in PKGDIR, usually /usr/portage/packages. When you no longer need to keep them around, or if they're too old, you can run
eclean-pkg to remove them from PKGDIR. It's a good way to ensure that any binary packages you have are only the latest versions.
For more information on
eclean and tips on maintaining a cruft-free system, please read
man eclean or check the eclean article.
We would like to thank the following authors and editors for their contributions to this guide:
- Matt Butcher
- John P. Davis
- Shyam Mani
- Xavier Neys
- Karl Trygve
- José Luis Rivero
- Joshua Saddler
- Douglas Anderson