Managing Debian alternative packages
Package Picker
© Photo by MacDonald Almeida on Unsplash
Maintain a list of alternative Debian packages and easily designate the default.
Debian-based systems are full of obscure packages and procedures. Users can run a Debian-based system for years and still be surprised by some of its features, especially if they are not developers. Yet these obscure features can sometimes be as helpful to ordinary users as anyone else. Diffoscope, for example, is intended as a tool for overseeing long-term support for official releases, but its support for binary files allows writers to fully take advantage of git, while debfoster and deborphan both assist in writing scripts for packages and in freeing up disk space by identifying unnecessary packages. Another case in point is the Debian alternatives system [1], which is used in package scripts such as postinst, prerm, and postrm, but it can also automate user interaction with over 120 applications through the update-alternatives command, potentially defining the choice of everything from text editors and web browsers to MP3 decoders and desktop wallpaper.
Unknown to many users, update-alternatives is installed by default on Debian-based systems. A fork also exists on Fedora-based systems [2], including Red Hat Enterprise Linux. The update-alternatives command is intended to manage packages with similar or duplicate functionality under a category or link group. This arrangement is useful because, like many distributions, Debian values freedom of choice. With 59,000 packages at last count [3], there can be numerous applications whose functionality is identical or overlaps. For example, Vim's variants include Elvis, Neovim, vim-tiny, and vim-nox, plus at least half a dozen others. Given many Linux users' fondness for constantly exploring applications, the older a system is, the more likely any set of variants is installed. Although Wayland has yet to be supported by update-alternatives, there are still dozens of link groups that make it a useful tool.
Roughly equivalent to the choice of default applications in many desktop environments, update-alternatives's main difference in functionality is that it can set which other applications a running application opens. For example, the crontab command uses the -e option to choose an editor in which to edit the command. Ordinarily, using -e opens a screen that lists available editors. By contrast, if a user's default editor is set with update-alternatives, this extra screen is skipped. You could get the same result by setting an editor as an environmental variable, but by using update-alternatives, you can maintain a list of choices and can change the default with a quick command. Note that on Debian and possibly some derivatives, you may need to change permissions on the command and its files to enable it.
[...]
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
Digital Autonomy
• The Answer Was Already on the Shelf
• Changing the Chip Industry: How Public Investment Has Grown Open Silicon
• United Nations Open Source Portal Goes Live
• EU Open Source Strategy Plays Key Role in Tech Sovereignty Package
• France Says “Au Revoir” to Microsoft
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
-
Advanced Video Coding Still Under Patent
Brazilian patent BRPI0109962B1 has expired, which means that DivX and Xvid are no longer problematic for Linux, but it doesn’t mean that video is all of a sudden fully unleashed.
-
2,000 Vulnerabilities per Linux Release
Thanks to AI bug hunters, the Linux kernel is seeing record numbers of vulnerabilities, and it's overwhelming developers.
-
Linux Exempt from California’s Age Verification Law
So long as Linux is distributed under the GPL, MIT, BSD, and Apache licenses, the OS is exempt from being required to verify the age of its users in California.
-
Roll Out the Cake: Linux Turns 35
35 years ago, a Finnish student began a humble project that would forever change the course of technology.
-
China Switching from Windows to Linux
China has ordered several government agencies to drop a Chinese-developed version of Windows 10 in favor of either KylinOS or UOS.
-
Pine64 Halts Production of Linux Devices
With continued DRAM and eMMC shortages, Pine64 has decided to discontinue production of Linux devices.
-
The Bullet-Proof KDE Software Initiative Is Coming
KDE, Techpaladin, and Kubuntu Focus have announced a new initiative that will provide at least three years of support for KDE Plasma 6.6 LTS and related software.
-
Linux Mint Shares a Possible Kernel Cleanup Solution
For those on Linux Mint who like to keep multiple kernels around but don't want them to take up too much space, you might be getting a new automated tool.
-
CachyOS Gets an Update
CachyOS August 2026 release is now available with the latest version of KDE, some new features, and plenty of improvements.
-
The Linux Kernel Dev Staging Area Now Rejects AI-Generated Patches
Unless a kernel patch is a valid security fix, it will be rejected if it was created using AI.
