Searching for package information on Debian and Ubuntu systems

65

Author: Bruce Byfield

New Linux users may be content with automatic updates and the package information shown by desktop tools, but more experienced users are generally more cautious and demanding. Experienced users, for instance, may want to assess the risk of an upgrade by studying its dependencies before they begin, or to overcome a package conflict by using versions from an older repository. Because of Debian’s long history of providing for advanced users, this sort of information is available from several different sources — from the apt-cache command, from distribution Web sites, and, in Ubuntu, with the new Ubuntu Simple Package Crawler. Unfortunately, no single source has all the features you are likely to want.

You’re likely to need additional information about applications because of the limitations of the resources installed by default. Debian’s dpkg and dpkg-query commands give detailed information about the packages and associated files on your system, but are of limited use with other packages. Similarly, apt-get’s main contribution to planning is the --simulate switch, which allows you to see what will happen if you try to install a particular package (you can also use --just-print, --dry-run, --recon, and --no-act, all of which have the same function as --simulate). But none of these switches gives you the complete information that you might want before installation, such as a detailed description of a package, what it conflicts with, or packages that might enhance the package.

Nor are desktop package management tools Synaptic or Adept, nor the text-based Aptitude, much better. All support simple searches that can crawl the repositories listed in the /etc/apt/sources.list file and find results for partial package names, but, so far as I can find, none can search using regular expressions, which means that you can easily miss related packages with slightly different names that might interest you.

By contrast, the apt-cache command gives more of the sort of information that you are likely to want at the planning stage, searching both package names and descriptions. It use the following format: apt-cache actionstring. For instance, apt-cache search pysol* finds all packages that include the string “pysol*” — and, you will notice, apt-cache supports regular expressions in its search. You can also use the depends action to find all dependencies for your search, or redepends to find all the other packages that depend on those for which you are searching. If you want the various versions in the repositories you are using, then you can add the --all-versions switch.

If you are not comfortable at the command line, and do not want to update your active repositories simply so you can search them, you may be more comfortable with the Debian or Ubuntu online package search pages. These are essentially the same tools, with Ubuntu’s being a modified version of Debian’s.

From either search page, you can choose whether to search repository directories, or the contents of packages. If you choose to search the directories, you can specify whether to search package names, their descriptions, or source packages, and whether to limit the search by release (in Ubuntu’s case) or repository (in Debian’s). If you choose instead to search by package content, you can also search by hardware architecture, or three limiting options: paths ending with the keyword, packages that contain files name like this, and packages that contain files whose names contain the keyword. Because of these limited options, searching the contents of packages is often the most useful option, since — annoyingly — neither searching repository directories nor searching the contents of packages supports regular expressions, and the Debian page may limit the display of results if your search string is too broad.

On both distributions’ search pages, you get a list of all results; the Ubuntu list is conveniently divided into exact hits and possibly related ones. Drilling down to an individual result, you will find a list of related packages, divided into depends (packages that you must install to run the package listed), recommends (packages that enhance the package listed, but aren’t necessary), and suggests (packages that might interest you, given your search). At the bottom of the page are links to the actual packages, arranged by architecture, although in most cases you are better off using apt-get or its graphical equivalent than downloading and installing a package by itself.

The main disadvantage of the Debian and Ubuntu search pages — aside from the fact that your Internet connection might occasionally be down, or the pages offline for maintenance — is the fact that you have to drill down three or four pages to find the information you want. This limitation is what makes the recently released Ubuntu Simple Package Crawler (USPC) potentially so attractive. Currently at version 0.4, USPC is approximately a KDE equivalent of the search engine found on the Ubuntu Web searcher. It can search on release and architecture, and list dependencies, but dispenses with the “recommends” and “suggests” categories — an omission that makes missing handy additions all too easy. For some reason, it also has an option to omit from search results any package that is installed by default in Ubuntu — perhaps on the grounds that such basic software should not be lightly updated. All the same, if USPC eventually provides more of the options that the Web searchers do, it may become a welcome addition to Ubuntu’s search tools, and one that I hope is imported to Debian as well.

Except for USPC, all these tools are usable with other distributions derived from Debian or Ubuntu; which Web searcher you should use, of course, depends on which distribution your distro gets its packages from. None of these choices is perfect, but, by employing them in appropriate combinations, you should be able to plan your software installations and upgrades more intelligently — and with fewer disasters — than with the default desktop tools alone.

Category:

  • System Administration