A toolkit for packages

Debian Goodies

Author(s):

The Debian Goodies collection offers a variety of time-tested scripts to help you manage Debian packages.

If you use a Debian-based system, you soon learn to install or remove packages with apt-get/dpkg. But, how do you access packages while they are on your system? One of Debian's answers to this question is Debian Goodies [1], a collection of scripts for administering .deb packages that is available on most Debian-based systems, including Linux Mint and Ubuntu.

The commands bundled in the Debian Goodies collection are small scripts, with such limited options and general purposes that none of them seem to deserve to be in a separate package. Over the past 14 years or so, each script has found its way into Debian Goodies, making it a collection of tools that ranges from small features for tracking broken packages or extracting copyright information to tools intended mainly for Debian developers fixing bugs in preparation for a release.

The scripts of Debian Goodies are not the only package-related tools on a Debian-based system. Except perhaps for their size, packages like apt-cache, apt-listbugs, apt-mirror, and a couple of dozen others could easily fit into the collection. However, the commands packaged under Debian Goodies have one overwhelming advantage – you only need to remember a single name to have access to a variety of tools.

However, presenting these scripts as a collection also means that dependencies are not always handled as well as they would have to be in separate packages. In at least two cases, you have to read a command's man page to realize that it needs other packages to run properly. Fortunately, the man page is a sensible starting point for any script that you need to be root user to run. The Debian Goodies scripts generally provide information, rather than editing packages in any way, but knowing what the tools can do can only help you use them more efficiently.

check-enhancements

The check-enhancements command is a relatively new addition to Debian Goodies, available in Testing's repository version, but not in Stable's. The command lists packages that enhance a other packages but are not strictly necessary to run it (Figure 1). For example, Gnome's Eye of Gnome (eog) does not need eog-plugins to perform its basic function of viewing files, but it gains extra features if the package is installed. These listings are especially welcome because the online descriptions of Debian packages are irregular about using the enhances category – sometimes putting packages that belong in it in the suggests category instead.

Figure 1: If you're looking for ways to improve an application, check-enhancements may be the script for you.

You can use the check-enhancements command to find enhancements for a single package (Figure 1). Or, you can use the -ip or --installed-packages options to list all the enhancements available for all installed packages or -ie or --installed-enhancements to view all enhancements. Given that even a moderately sized system can contain several thousand packages, both of these processes can take more than half an hour to run.

checkrestart

When you run apt-get dist-upgrade, all the packages installed on your system are upgraded. This process usually revolves around closing and restarting services as part of the upgrade. Major services like PulseAudio and GDM3 are generally reset automatically by init scripts, but smaller ones associated with desktop environments, such as KDE's akonadi-server, or applications like GIMP may not be.

Ordinarily, restarting the system will restart all the services. However, if you are running applications that you do not want to interrupt, you can use the checkrestart command to restore the services you need. The script lists each service's name, process ID, and file path.

The default for checkrestart is to list all packages that could be restarted (Figure 2). However, you can receive a report on a single package with -p NAME or --package NAME or omit packages from the report with -i NAME or --ignore=NAME. The -v or --verbose option gives you more detailed information about what checkrestart is doing but produces an otherwise similar report.

Figure 2: Use checkrestart after a system upgrade to make sure that all services have been restarted.

debget

The debget command downloads a package from apt-get's sources to the current working directory (Figure 3). It requires cURL for the downloading. The command accomplishes exactly the same purpose as downloading a package directly from the link on its online description. Usually, you would use debget when you want to examine or edit a package.

Figure 3: With debget, you can download a package directly using cURL.

debman

Using debman, you can search and read man pages from uninstalled packages (Figure 4). The command has two formats: With the use of -f FILENAME, it reads the man pages from a local copy of the uninstalled package specified, and with -p PACKAGE, it downloads and displays a man page for the uninstalled package specified from the system's repositories. If more than one source is available, the command returns the alternatives so that you can enter a more precise command.

Figure 4: The debman command lets you examine the man page of uninstalled packages.

debmany

Although many users think of man pages only in terms of help files, Debian packages use man for a variety of other files, including acknowledgements, readme files, and copyright notices. The debmany command prepares a list of all the man pages in an installed or uninstalled package then displays the one you select (Figure 5). It allows one selection at a time, after which you must re-enter the command to select another man page.

Figure 5: Packages include small libraries of man pages. The debmany command helps you browse those libraries.

dglob

As the name suggests, the dglob command uses regular expressions to search package names. By default, it searches only installed packages, but you can add the -a option to search uninstalled ones as well. By adding -f, you can also search for files instead of packages.

To search packages, dglob calls on grep-dctrl (Figure 6). The man page for grep-dctrl conveniently summarizes the sorts of questions it can answer, including: What is the Debian package foo? Which version of the Debian package bar is now current? Which Debian packages does John Doe maintain, and which Debian packages are somehow related to the Scheme programming language?

Figure 6: The dglob script calls on grep-dctrl to search packages for regular expressions.

As these questions suggest, dglob is one of the most powerful scripts in Debian Goodies.

dgrep

When a package is installed, its files are usually scattered throughout your system. Its man pages, for instance, are placed in a /doc directory, and its binary files in a /bin directory. The dgrep command lets you search these scattered files using grep (Figure 7).

Figure 7: With dgrep, you can do grep-like searches on a package's files.

The dgrep tool supports the normal regular expressions, as well as most of grep's options, with the exception of -r or --recursives and grep options that refer specifically to directories. It does not include symbolic links in its results. However, you can specify a variation of grep with the commands degrep, dfgrep, or dzgrep.

dpigs

Are you curious about the largest installed packages on your system? Then, dpigs can answer your questions. Entering the dpigs command by itself gives you a listing of the top 10 largest binary packages (Figure 8). If you modify the command with the option -nNUMBER or --lines=NUMBER, you can view as many listings as you choose. If you add -S or --source, you can view the largest source packages only. The results of the dpigs command can help you streamline your system, but you should investigate candidates for removal carefully, because large packages are often ones that are essential to your system.

Figure 8: Discovery the most memory-intensive packages with dpigs.

popbugs

The popbugs command requires the installation of the Debian Popularity Contest to run [2]. Debian Popularity Contest keeps track of the most used packages on the system. Once a week, it runs a cronjob to send the information gathered to the Debian project, which uses the information for planning things such as which applications will go onto install CDs. You can opt in or out of Debian Popularity during installation; if you opt out, it is not installed.

Popbugs generates a list of release critical bugs – in other words, major ones – against the packages listed in your Debian Popularity Contest, producing a web report in your default browser (Figure 9). Alternatively, you can use the option --output=FILE to print the report to file.

Figure 9: The popbugs command uses Debian Popularity Contest to track release critical bugs.

This report is mostly useful for developers who are actively helping to prepare a new release. The report is also useful for system administrators who want to keep track of vulnerabilities, although it does not provide any updates for patching your system.

which-pkg-broke

The which-pkg-broke command displays all the dependencies for a package and when each was installed. This information can take a few seconds to retrieve and quickly fills several screens with its output, so you might want to pipe the command through less.

In theory, you can then identify which packages might be causing problems by correlating when installation problems began with which packages were installed around that time (Figure 10). In practice, however, this command has only limited usefulness, because not all packages record their installation time.

Figure 10: The which-pkg-broke command provides information that can help you repair a broken system.

Hands-On Administration

Like dpkg-reconfigure [3], the scripts in the Debian Goodies collection are part of the unique technology that Debian has built during the past two decades. This technology has been passed along, mostly unchanged, to its derivatives – even those that emphasize the desktop rather than the command line.

The opportunities that this technology offers can be overwhelming; however, it provides a hands-on approach to administering your system that few other Linux alternatives can match.

Take the time now to learn what Debian Goodies offers, making mental notes about the scripts you imagine you are most likely to use. Then, whether you are troubleshooting your system or simply curious about different aspects of your system, you will know what resources are available to you.

Infos

  1. Debian Goodies: http://packages.debian.org/sid/debian-goodies
  2. Debian Popularity Contest: http://popcon.debian.org/
  3. "Command Line: dpkg-reconfigure" by Bruce Byfield, Linux Pro Magazine, October 2013, pg. 76

The Author

Bruce Byfield is a computer journalist and a freelance writer and editor specializing in free and open source software. In addition to his writing projects, he is also a fan of parrots, heavy exercise, British folk-rock, science fiction and 19th century novels. In his spare time, Bruce writes about Northwest Coast art. You can read more of his work at http://brucebyfield.wordpress.com