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
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.