Package management with wajig
Rationalizing Debian
The wajig tool simplifies package management using self-explanatory sub-commands.
Debian's package tools are famous for their reliability. However, their weakness is that they developed over decades with little centralized planning. As a result, the Debian archives now list 44 package utilities starting with "apt" alone [1], each with its own set of options. Add other packages, such as dpkg and alien, and the total is closer to 60. Wajig [2] reduces this complexity by uniting package management under a single command with self-explanatory sub-commands.
Wajig has been an open secret in the Debian world for two decades. Graham Williams of Togaware, wajig's original developer, explains that users had trouble remembering not only Debian's commands but also "the extra greps and awks and finds that would be commonly used in conjunction with them. I was also regularly coming across tips and tricks for managing the system from various newsgroups and blog posts. I used to write them down in documents and cheat sheets, but then started to bring them together into a single command."
Because package management is an administrative function, Williams wrote it as a command-line tool. "Whilst GUIs can deliver quite a bit of simplicity and yet still offer quite a bit of power," Williams says, they can't do everything that we do from the command line."
Wajig is a Python script that maps its sub-commands to standard commands such as dpkg
, apt-cache
, and wget
. Most of these standard commands are installed by default in distributions; but, if they are not installed, wajig will tell you what you need to install when you run the sub-command. You can install it just as you would any other package.
Only a token man page accompanies wajig, but you can read a summary of its mappings by entering wajig help
or a one-line explanation by entering wajig -commands
. For full documentation, increase the verbosity level with wajig docs
or wajig --verbose=2
help (Figure 1). The same documentation is available online [3].
The basic structure of the command resembles that of apt-get or dpkg:
wajig SUB-COMMAND OPTIONS [PACKAGES, FILES, or STRINGS]
Many of the sub-commands are identical to those used in apt-get or dpkg, which helps make wajig easy to learn. Many sub-commands can be run by ordinary users, but those that involve installing or removing packages invoke sudo
first. If you do not have sudo set up on your system, you will have to run these sub-commands as root instead.
Wajig Options
Besides --verbose
, wajig also includes a limited number of options. The opposite of --verbose
is --quiet
or -q
, which runs the command without any feedback. By default, wajig assumes authenticated archives, but you can work with unauthorized archives by prefacing the sub-command with --noauth
or -n
.
Another useful option is --simulate
or -s
, which tells you what wajig will do when you enter a command without actually doing it (Figure 2). This option is useful if you are upgrading packages that are essential to your system or GUI and want to check if you are likely to encounter problems.
Another option, --teaching
or -t
, appears to have been superseded in the latest releases without being removed from the documentation. The teaching
option seems to have been replaced by equivalent sub-commands, just as wajig help
replaces --help
. Instead of --teaching
, use the showdistupgrade
, showinstall
, showremove
, or showupgrade
sub-commands – whichever is appropriate for what you are doing.
Basic Package Management
Using wajig is largely a case of knowing which sub-commands to use and following the occasional directions that wajig offers while you work. For example, before installing packages, you may want to run wajig
with edit
so you can edit the list of repositories at /etc/apt/sources.list
. If you edit the repositories or have not updated them in some time (you can check by running last-update
), then you probably need to run update
to get a current list of available packages.
Before installing a package, you might also run wajig with bug
, so you can read about the latest problems or report problems you have already found (Figure 3). Running changelog
, too, might tell you how packages have changed between versions, which could occasionally be useful – perhaps when a package has been updated to use systemd instead of init, or Wayland rather than init.
If you are unable to find a package, you can search by entering a package name or a string after the sub-command list-names
. If you have several repositories enabled, you can use apt-cache's madison
to see a list of available versions (Figure 4).
Installing or upgrading includes several convenient sub-commands, all based on apt-get. Besides the basic install
, you can use installsuggested
to install all suggested packages listed for a package – that is, packages that enhance but are not needed. You also have the option of pinning the install to a particular repository with install/dist REPOSITORY
.
Additionally, installation can be automated by using auto-install
so that wajig does not prompt you with questions about the installation, or you can simply run auto-download
to update the repository lists and then install all updated packages. More simply still, upgrade
installs the latest versions of the packages listed after it, or, if left unqualified, all packages already installed.
If you run into problems during installation, you have apt-get's full array of problem-solving tools: fix-install
, fix-missing
, and force
(Figure 5). A problem package can be held back with hold
or installed again with unhold
. Yet another option is to use reinstall
on a package – after, of course, updates have appeared in the repository or you have added another repository.
Removing packages is as versatile as installing them. The sub-command remove
uninstalls a package, as with apt-get, whereas purge
removes all the package's files, as with dpkg. You also have the option of using remove-depend
to delete both packages and any dependents not required by other packages – a choice that removes the need to run remove-orphans
to clean up after you are finished. However, you may want to run auto-clean
to remove any packages that have been replaced with more up-to-date versions.
Getting Package Information
One of wajig's strengths is its sub-commands for learning more about packages. By specifying a package with the sub-command contents
, you can view the files in a package; using list-scripts
or list-sections
, you can see the files in specific parts of the package. Similarly, dependents
lists the packages that depend on, recommend, or suggest a package (Figure 6). If you know the command or file you need but are unable to find it, whichpkg
can help you track down the package to install (Figure 7).
If you really want to know more about a package, the sub-commands starting with list
are the place to start. The list
command itself gives you the status of all installed packages. Using list-alts
shows the alternatives, if any, for the package, and list-daemons
shows the services that are stopped and restarted when the package is installed. More specifically, list-file
gives the files that a package installs on your system. More generally, list-log
shows which packages have been installed or removed.
Many of these information sub-commands are more useful to a network administrator than someone on a home system. All the same, a nodding familiarity with them can be handy if you run into serious problems and want some insight into what happened.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
First Release Candidate for Linux Kernel 6.14 Now Available
Linus Torvalds has officially released the first release candidate for kernel 6.14 and it includes over 500,000 lines of modified code, making for a small release.
-
System76 Refreshes Meerkat Mini PC
If you're looking for a small form factor PC powered by Linux, System76 has exactly what you need in the Meerkat mini PC.
-
Gnome 48 Alpha Ready for Testing
The latest Gnome desktop alpha is now available with plenty of new features and improvements.
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.