You made a rather big mistake, in taking for granted that nala
doesn't need apt
- it does.
This is completely evident by running apt depends nala
, showing nala
's dependencies.
nala
Depends: python3-anyio
Depends: python3-httpx
Depends: python3-pexpect
Depends: python3-rich
Depends: python3-tomli
Depends: python3-typer
Depends: python3-typing-extensions
Depends: <python3:any>
python3
Depends: apt
Depends: python3-apt
Depends: python3-debian
Recommends: python3-socksio
So nala
will not function without apt
.
If you had carefully read the output of the command nala remove apt --remove-essentials
, you would most likely see that it was about to remove the nala
package itself. Hence, it's important to review what the command is about to do, especially when you run the command with the --remove-essentials
option (an option that can potentially break the system).
It's generally a good idea to do a --dry-run
before removing critical packages, or running with --remove-essentials
- and ironically, this is an option that only apt
supports, but nala
does not (yet).
Also, you didn't state why you suddenly wanted to remove apt
, but I have some guesses:
You would like to "clean up" your packages.
This is sometimes a good idea, but not when you're not sure of the consequences. Also, if you had read the first part of the nala
readme:
Nala is a front-end for libapt-pkg
. Specifically we interface using the python-apt
api.
Or from the package info apt show nala
:
Commandline frontend for the APT package manager
This should have given you a hint that it's dependent on apt.
You're satisfied with the performance of nala
for common tasks, and thus don't need apt
.
You may think this is the case, but I'd argue it's not. nala
is software in a development stage, while apt
has existed for 30 years. Also, while nala
provides the most common functionality of apt
, it can't do any of the more advanced stuff, which you suddenly might need (like --dry-run
) - and often when you least expect it. So for daily tasks nala
might be OK - but it can probably never replace the full apt
package.
Now to restore apt
to your system after you have removed it, please see this Q&A. The file /var/log/apt/history.log
should actually contain a list of all the packages that were removed, which you have to reinstall manually.
What you basically have to do is find the appropriate version of apt
(example for Jammy) for your system and all it's dependent packages, and install these manually with dpkg
(since you removed the only package manager that can actually handle dependencies for you).