An improved front end for Apt
Apt on Steroids
The Nala front end for Debian's Apt package manager combines the reliability of the Apt tools with easier to read output and speedier downloads.
Debian's package management system for the command line relies on dpkg [1] in the background and the Advanced Package Tool (Apt) [2] with its default front end, apt
. While apt
usually does a reliable job, its command-line tools (based on the libapt-pkg and libapt-inst libraries), such as apt
, apt-file
, apt-policy
, and the like, are not particularly clear-cut or attractive. In addition, the Apt front end is slow.
This, along with other shortcomings in the tools available in Debian, prompted longtime Debian developer, Michael Stapelberg, to announce his retirement in 2019 with some harsh criticism [3]. Stapelberg subsequently created the proof of concept distri distribution, with the goal of optimizing package management in general (Linux Magazine previously covered distri in July 2021 [4]).
Nala, which was inspired by Fedora's DNF package manager, steps up to eradicate these shortcomings, offering easier to read output and increased speed thanks to parallel downloading.
What Apt Does
As part of Apt on Debian, Ubuntu, and their derivatives, apt
is the interactive command-line utility that takes care of package management. It performs tasks such as installing, uninstalling, or searching for packages and displaying information about them. While apt
does not offer color-highlighted output (Figure 1), it does at least have a progress bar. You can interact with apt
through subcommands such as update
, upgrade
, full-upgrade
, install
, remove
, and purge
. The packages installed via apt
are based on the repositories entered in the source list below /etc/apt/sources.list.d/
.
Since the beginning of the year, another Apt front end named Nala has been making the rounds. Unlike apt
, Nala uses the python-apt
[5] library. This library provides access to almost all the features supported by Apt's underpinnings, the libapt-pkg and libapt-inst libraries. It's only logical that front-end programs for Apt, such as Nala, can be written in Python.
Although still quite new, Nala can already be found in the repositories of distributions such as Debian Testing and Unstable, Kali Linux, MX Linux, Raspbian Testing, and Ubuntu 22.04 backports. For other Debian derivatives, you need to include the developer's repository as described in the wiki on GitLab [6]. Alternatively, you can download the tool as a DEB package and install it directly.
Currently, Nala version 0.11.1 can be used in the Bash, ZFS, and Fish shells. For Debian Stable, Ubuntu 21.04, and distributions based on their package set, you need to use the nala-legacy package, which provides the same functions and is only adapted to the older package set in terms of dependencies. You cannot use Nala with older distributions, such as Ubuntu 18.04 or Debian 10 (buster).
What Nala Offers
Because of the many changes, it is important to be able to intuitively understand the package manager's output during package installations or updates of the entire installation at the command line – especially if you use Debian Testing or Unstable, or other rolling release distributions based on DEB packages. This desire for clarity is one of the starting points for Nala: The output should be more accessible, detailed where necessary, and unobtrusive where possible. Nala achieves this goal by using more color highlighting and clearer output formatting (Figure 2).
When called, Nala acts a little different from apt
. The command
sudo nala update
has the same result as
sudo apt update
It updates the sources list in etc/apt/sources.list.d
. On the other hand, if you type
sudo nala upgrade
Nala will run an
apt update && apt full-upgrade
as shown in Figure 3. This is because the developers designed Nala with rolling releases in mind. However, the command works just as well on stable distributions.
When updating, Nala highlights important aspects of the output in color, which shows at a glance which repositories offer new packages and to which version a package will be updated. In addition, the tool color highlights all of the repositories that it ignores due to an incorrect configuration or a missing key. While updating packages, Nala reliably shows you a progress bar with the remaining time, the completed workload as a percentage, and the number of packages already processed compared to the total update (Figure 4).
One of Nala's less desirable quirks is to additionally integrate
sudo nala upgrade
with
sudo apt autoremove
which removes packages that are no longer needed (Figure 5). As experience shows, packages that are actually needed will still disappear from time to time. The recommended approach is to prevent this behavior by calling Nala with the --no-autoremove
parameter.
Alternatively, you can prevent this behavior permanently in the /etc/nala/nala.conf
file by setting the second entry to auto_remove = false
. If you want Nala to clean up the package inventory, use the --autoremove
parameter. In the configuration file, you will find some additional simplifying settings that Apt does not offer, which includes hooks that automatically perform scripted actions before or after installing a package. A video on Reddit explains this feature and shows an example [7].
If apt
is indelibly embedded in your finger muscle memory, you can create an alias and keep using the familiar commands while Nala is working in the background.
What Slows Apt Down
Since 2002, the Debian developers have been resisting allowing parallel downloading from the same server on the grounds that it puts too much load on the servers while offering little gain [8]. Today, in view of HTTP/2 and soon HTTP/3, this argument needs to at least be verified. Other distributions have long since allowed parallel downloading from the same host. On Debian, you can install the apt-fast
shell script wrapper from GitHub [9]; it drastically improves apt
's download times by downloading packages in parallel, with multiple connections per host.
Nala makes apt-fast
obsolete: Parallel downloading is already part of Nala's strategy. By default, Nala downloads three packages per unique mirror server in your source list. Also, Nala alternates downloads between available mirrors to boost speed further. If a server fails for any reason, Nala tries the next one until it has processed all defined servers.
And that's not all: You can run
sudo nala fetch
to tell Nala to test all available mirror servers for the performance at your location (Figure 6). In testing, Nala speed-checked 332 servers, resulting in a list of the 16 fastest German and European servers at our site. The first server in the list had a response time of 21ms, while the last clocked in at 28ms. You can enter the desired servers as a space-separated list of numbers and confirm by pressing the Enter key. Nala then writes the desired servers to a new source list named nala-sources-list
and uses it from then on. It is a good idea to repeat this procedure every few months.
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
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.