Could I remove apt with apt?

I know that I can use apt-get remove <package> to remove a program.

But apt is a program itself. Could I use apt-get remove apt to remove it, or would it get confused part way through?


APT lets you simulate your commands using the option -s. You can try this yourself, issuing the command apt-get -s remove apt (no sudo needed).

This yields the following output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apturl-common xul-ext-ubufox
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  apt apt-utils apturl nautilus-share python3-software-properties
  software-properties-common software-properties-gtk ubuntu-desktop
  unattended-upgrades
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt
0 upgraded, 0 newly installed, 9 to remove and 0 not upgraded.
Remv ubuntu-desktop [1.341]
Remv nautilus-share [0.7.3-1ubuntu5]
Remv apturl [0.5.2ubuntu9]
Remv software-properties-gtk [0.96.13.1]
Remv software-properties-common [0.96.13.1]
Remv python3-software-properties [0.96.13.1]
Remv unattended-upgrades [0.86.2ubuntu1]
Remv apt-utils [1.0.10.2ubuntu1]
Remv apt [1.0.10.2ubuntu1]

So the answer should be: yes, you can.


You can...

sudo apt-get remove apt
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages will be REMOVED:
  apt apt-utils apturl nautilus-share python3-software-properties
  software-center software-properties-common software-properties-gtk
  ubuntu-desktop ubuntu-extras-keyring ubuntu-minimal unattended-upgrades
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt
0 upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
After this operation, 9,031 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] Yes, do as I say!
(Reading database ... 179817 files and directories currently installed.)
Removing ubuntu-desktop (1.327) ...
Removing nautilus-share (0.7.3-1ubuntu5) ...
Removing apturl (0.5.2ubuntu4) ...
dpkg: warning: while removing apturl, directory '/usr/lib/python3/dist-packages/AptUrl/gtk/backend' not empty so not removed
Removing software-properties-gtk (0.94) ...
dpkg: warning: while removing software-properties-gtk, directory '/usr/lib/python3/dist-packages/softwareproperties/gtk' not empty so not removed
Removing software-properties-common (0.94) ...
Removing python3-software-properties (0.94) ...
Removing unattended-upgrades (0.82.8) ...
Removing ubuntu-minimal (1.327) ...
Removing apt-utils (1.0.9.2ubuntu2) ...
Removing software-center (13.10-0ubuntu4.1) ...
Removing ubuntu-extras-keyring (2010.09.27) ...
OK
Removing apt (1.0.9.2ubuntu2) ...
Processing triggers for man-db (2.7.0.2-2) ...
Processing triggers for gconf2 (3.2.6-2ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu2) ...
Processing triggers for bamfdaemon (0.5.1+14.10.20140925-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.55ubuntu1) ...
Processing triggers for dbus (1.8.8-1ubuntu2) ...
Processing triggers for libc-bin (2.19-10ubuntu2) ...

and will be warned you are about to do something very destructive. I must say ... the list of packages looks horrific for a space saving of less then 6000kb :D

It does finish but there is no way back using "apt-get". Ubuntu Software Center will no longer work and you would need to use "dpkg" to re-install a package manager (and manually also need to install all the dependencies).


Once, back when I ran CoreUbuntu, I installed a buggy package from source which apt decided obsoleted apt. Next time I ran apt autoremove, I didn't actually look at the list of software to be removed and apt was in the list.

Imagine my surprise next time I typed apt install <package-name> and got The program 'apt' is currently not installed. You can install it by typing: sudo apt-get install apt.

Luckily, for some reason, autoremove didn't remove any of apt's dependencies so all I had to do was wget apt's .deb archive and reinstall using dpkg -i.


As shown in the other answers, if you remove apt with apt, you'll be in more trouble because of the dependencies it tries to resolve.

I find it interesting but it is indeed the case that (certainly for Debian, and perhaps Fedora/openSUSE to an extent?) many modern distros are defined and built largely upon the infrastructure provided by their package manager of choice.