-1

I realized that, aside from a warning, nothing is stopping you from running

sudo apt purge apt

If someone did run that, how do you reinstall apt, because you no longer have apt to install with?

user8292439
  • 3,808

2 Answers2

2

You can manually download apt from https://packages.ubuntu.com/. Just select your ubuntu from the list and open "Administration Utilities". In this list you will find "apt" and than you can select the right architecture.

Once downloaded you can install it like this:

sudo dpkg -i package_name
0

If you still have packages in your local package archive (/var/cache/apt/archives) reinstallation might be as simple as:

sudo dpkg --install /var/cache/apt/archives/apt_1.2.24_i386.deb
# Note that dpkg uses path/to/file_name.deb, not package_name

If dependencies have also been uninstalled, the error message will tell you which dependencies must also be reinstalled.

If the local package archive is empty (oops!), then you must download each package manually from http://packages.ubuntu.com, and use dpkg to install them. Just like the good old days of 1998....

sudo dpkg --install /home/users/$USER_NAME/Downloads/apt_1.2.24_i386.deb
# Note: Edit the path and file_name.deb to match your situation

If uninstalling apt was part of a larger catastrophe, then you must balance the time and effort of repair vs a fresh reinstall.

user535733
  • 62,253