NALA: APT on steroids

At the time I started using Linux there were some good distros based on RPM (Redhat Package Manager) like, Mandrake, Redhat, SuSE and many other. Sometime this package manager experienced some problems updating packages especially on long run servers where configuration have been manually customized.

One day I tried another distro called Debian and I immediately realized that the package manager in this distro, called APT, was the best at the time. I never had package dependency problems like sometime it happened using RPM based distros.

Debian became my distro of choice at the time and already it is, and APT helped me to keep my servers up to date with no efforts. For some years I used aptitude which was more efficient in some cases where conflicts between packages occurs. Aptitude is able to provide multiple upgrade solutions to solve those conflicts.

Along the time other package manager appeared on the market. Today didstro based on Arch make use of pacman . Pacman is faster than APT because the arch packages are simpler than deb packages. The syntax is shorter, for example:

1# APT upgrade
2apt-get update && apt-get dist-upgrade
3apt-get update && apt-get upgrade
4
5# The same command in pacman
6pacman -Syu

APT takes a lot of time upgrading a system installed with an old image when it is requiresd to download and install hunderds of packages.

I discovered this package manager, built on top of APT, which makes APT faster and more catchy as interface. This package manager is called Nala and you can find it here.

For people who uses Linux Mint bear in mind to install the right version accordingly to your MInt version:

  • Mint 20.3 and under use nala-legacy

  • Mint 21 and over use nala package

Nala provides more detailed information about the whole update/upgrade process compared to APT.

For example if you want to get information about a specific package in APT:

 1➤ apt show mtr
 2Package: mtr
 3Version: 0.93-1
 4Priority: extra
 5Section: universe/net
 6Origin: Ubuntu
 7Maintainer: Ubuntu Developers <[email protected]>
 8Original-Maintainer: Robert Woodcock <[email protected]>
 9Bugs: https://bugs.launchpad.net/ubuntu/+filebug
10Installed-Size: 223 kB
11Depends: libc6 (>= 2.29), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libncurses6 (>= 6), libtinfo6 (>= 6)
12Breaks: mtr-tiny, suidmanager (<< 0.50)
13Replaces: mtr-tiny
14Homepage: http://www.bitwizard.nl/mtr/
15Download-Size: 69,7 kB
16APT-Sources: http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
17Description: Full screen ncurses and X11 traceroute tool
18 mtr combines the functionality of the 'traceroute' and 'ping' programs
19 in a single network diagnostic tool.
20 .
21 As mtr starts, it investigates the network connection between the host
22 mtr runs on and a user-specified destination host.  After it
23 determines the address of each network hop between the machines,
24 it sends a sequence of ICMP ECHO requests to each one to determine the
25 quality of the link to each machine.  As it does this, it prints
26 running statistics about each machine.

The Nala output is more readable: and more detailed:

 1➤ nala show mtr
 2Package: mtr
 3Version: 0.93-1
 4Architecture: amd64
 5Installed: no
 6Priority: extra
 7Essential: no
 8Section: universe/net
 9Source: mtr
10Origin: Ubuntu
11Maintainer: Ubuntu Developers <[email protected]>
12Original-Maintainer: Robert Woodcock <[email protected]>
13Bugs: https://bugs.launchpad.net/ubuntu/+filebug
14Installed-Size: 223 KB
15Depends: 
16  libc6 (>= 2.29)
17  libgdk-pixbuf2.0-0 (>= 2.22.0)
18  libglib2.0-0 (>= 2.12.0)
19  libgtk2.0-0 (>= 2.8.0)
20  libncurses6 (>= 6)
21  libtinfo6 (>= 6)
22Replaces: mtr-tiny
23Breaks: mtr-tiny, suidmanager (< 0.50)
24Homepage: http://www.bitwizard.nl/mtr/
25Download-Size: 70 KB
26APT-Sources: http://archive.ubuntu.com/ubuntu/ focal/universe amd64 Packages
27Description: Full screen ncurses and X11 traceroute tool
28 mtr combines the functionality of the 'traceroute' and 'ping' programs
29 in a single network diagnostic tool.
30 .
31 As mtr starts, it investigates the network connection between the host
32 mtr runs on and a user-specified destination host.  After it
33 determines the address of each network hop between the machines,
34 it sends a sequence of ICMP ECHO requests to each one to determine the
35 quality of the link to each machine.  As it does this, it prints
36 running statistics about each machine.

To install a package with Nala you can proceed as follow:

 1➤ sudo nala install mtr
 2==================================================================================================
 3 Removing                                                                                         
 4==================================================================================================
 5  Package:                        Version:                                                 Size:  
 6  mtr-tiny                        0.93-1                                                  168 KB  
 7
 8==================================================================================================
 9 Installing                                                                                       
10==================================================================================================
11  Package:                        Version:                                                 Size:  
12  mtr                             0.93-1                                                   70 KB  
13
14==================================================================================================
15 Summary                                                                                          
16==================================================================================================
17 Remove  1 Packages                                                                               
18 Install 1 Packages                                                                               
19
20 Total download size  70 KB   
21 Disk space required  55 KB   
22
23Do you want to continue? [Y/n] y
24
25
26╭─ Downloading… ─────────────────────────────────────────────────────────────────────────────────╮
27│ Total Packages: 1/1                                                                            │
28│ Last Completed: mtr_0.93-1_amd64.deb                                                           │
29│ Time Remaining: 0:00:00 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 69.7/69.7 KB • 786.9 KB/s │
30╰────────────────────────────────────────────────────────────────────────────────────────────────╯
31╭─ Installing Packages ──────────────────────────────────────────────────────────────────────────╮
32│Removing:   mtr-tiny (0.93-1)                                                                   │
33│Unpacking:  mtr (0.93-1)                                                                        │
34│Setting up: mtr (0.93-1)                                                                        │
35│Processing: triggers for man-db (2.9.1-1)                                                       │
36│╭──────────────────────────────────────────────────────────────────────────────────────────────╮│
37││✔ Running dpkg … ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00 • 5/5││
38│╰──────────────────────────────────────────────────────────────────────────────────────────────╯│
39╰────────────────────────────────────────────────────────────────────────────────────────────────╯
40Finished Successfully

The speed is comparable in case of a single package but in case of multiple packages, nala is much faster since it downloads three packages in parallel from each configured mirror. This reduces the update/upgrade process drastically.

Nala has function to configure the best list of mirrors to work with, measuring the speed and allowing the user to select from a list which mirrors to use in the package installation process.

 1➤ sudo nala fetch
 2Fetching Ubuntu mirrors…
 3╭─  Fastest Mirrors ─────────────────────────────────────────────────────────╮
 4│                                                                            │
 5│   Index    Mirror                                                  Score   │
 6│       1    http://mirror.deace.id/ubuntu/                          9 ms    │
 7│       2    http://giano.com.dist.unige.it/ubuntu/                  11 ms   │
 8│       3    http://mirror.united-gameserver.de/ubuntu/              13 ms   │
 9│       4    http://ubuntu.mirror.root.lu/ubuntu/                    13 ms   │
10│       5    http://ftp.rezopole.net/ubuntu/                         14 ms   │
11│       6    http://linux.darkpenguin.net/distros/ubuntu-archive/    14 ms   │
12│       7    http://mirror.serverloft.eu/ubuntu/ubuntu/              14 ms   │
13│       8    http://ftp.hosteurope.de/mirror/archive.ubuntu.com/     15 ms   │
14│       9    http://ftp.uni-kl.de/pub/linux/ubuntu/                  15 ms   │
15│      10    http://ubuntu.lagis.at/ubuntu/                          15 ms   │
16│      11    https://mirror.solnet.ch/ubuntu/                        15 ms   │
17│      12    https://pkg.adfinis.com/ubuntu/                         15 ms   │
18│      13    http://archive.ubuntu.csg.uzh.ch/ubuntu/                16 ms   │
19│      14    http://mirror.eu-fr.kamatera.com/ubuntu/                16 ms   │
20│      15    http://ftp.stw-bonn.de/ubuntu/                          17 ms   │
21│      16    http://mirror.serverius.net/ubuntu/                     17 ms   │
22│                                                                            │
23│   Score is how many milliseconds it takes to download the Release file     │
24╰────────────────────────────────────────────────────────────────────────────╯
25Mirrors you want to keep separated by spaces (1..16): 

The fetch functions tests all the available mirrors and return a list of the fastest. You can configure which mirros to use during the installation operations.

Updating packages on the system is very fast:

 1➤ sudo nala update
 2╭─ Updating Package List ────────────────────────────────────────────────────────────────────────╮
 3│No Change: https://packages.microsoft.com/repos/ms-teams stable InRelease                       │
 4│No Change: http://repository.spotify.com stable InRelease                                       │
 5│No Change: http://archive.canonical.com/ubuntu focal InRelease                                  │
 6│Updated:   http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 KB]                  │
 7│No Change: http://security.ubuntu.com/ubuntu focal-security InRelease                           │
 8│Ignored:   https://repo.vivaldi.com/stable/deb stable InRelease                                 │
 9│No Change: https://repo.vivaldi.com/snapshot/deb stable Release                                 │
10│Updated:   https://typora.io/linux ./ InRelease [793 Bytes]                                     │
11│No Change: http://deb.volian.org/volian scar InRelease                                          │
12│No Change: https://repo.vivaldi.com/stable/deb stable Release                                   │
13│Ignored:   http://packages.linuxmint.com una InRelease                                          │
14│No Change: https://download.sublimetext.com apt/stable/ InRelease                               │
15│No Change: http://packages.linuxmint.com una Release                                            │
16│No Change: https://packages.expandrive.com/expandrive stable InRelease                          │
17│No Change: https://repo.nordvpn.com//deb/nordvpn/debian stable InRelease                        │
18│Updated:   http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [278 KB]   │
19│Updated:   http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [391 K…│
20│Updated:   http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944…│
21│Updated:   http://archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [8 KB]   │
22│Updated:   http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30 …│
23│Fetched 931 KB in 1s (0 Bytes/s)                                                                │
24╰────────────────────────────────────────────────────────────────────────────────────────────────╯
25All packages are up to date.

It is possible to see the update history and perform targetted rollbacks:

1➤ sudo nala history
2[sudo] password for madghigno:             
3  ID    Command        Date and Time               Altered    Requested-By      
4  1     install mtr    2022-08-20 16:28:31 CEST          2    madghigno (1000)

To show the details about a specific transaction:

 1➤ nala history info 1
 2==========================================================================================
 3 Removed                                                                                  
 4==========================================================================================
 5  Package:                      Version:                                           Size:  
 6  mtr-tiny                      0.93-1                                            168 KB  
 7                                                                                          
 8==========================================================================================
 9 Installed                                                                                
10==========================================================================================
11  Package:                      Version:                                           Size:  
12  mtr                           0.93-1                                             70 KB  
13                                                                                          
14==========================================================================================
15 Summary                                                                                  
16==========================================================================================
17 Removed   1 Packages                                                                     
18 Installed 1 Packages 

To rollback a specific transaction:

 1➤ sudo nala history undo 1
 2==========================================================================================
 3 Removing                                                                                 
 4==========================================================================================
 5  Package:                      Version:                                           Size:  
 6  mtr                           0.93-1                                            223 KB  
 7                                                                                          
 8==========================================================================================
 9 Summary                                                                                  
10==========================================================================================
11 Remove 1 Packages                                                                        
12                                                                                          
13 Disk space to free  223 KB   
14                              
15Do you want to continue? [Y/n] 

The options available makes APT able to compete with other and most modern package managers for Linux, like pacman and DNF, the default package manager for Linux Fedora.

Nala, like aptitude is built on APT but provides a better user interface and faster performance. I suggest to give it a try.