How to install apt back after apt-transport-https uninstalled it

Romeo Mihalcea asked:

I followed a suggestion and bricked my server. I no longer have apt / apt-get after installing apt-transport-https and I regret it.

I tried installing apt via dpkg but it errors out with:

dpkg: regarding apt_1.8.2.1_amd64.deb containing apt:
 apt breaks apt-transport-https (<< 1.5~alpha4~)
  apt-transport-https (version 1.4.10) is present and installed.

dpkg: error processing archive apt_1.8.2.1_amd64.deb (--install):
 installing apt would break apt-transport-https, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:

how do I uninstall apt-transport-https and revert back?

My answer:

The version of apt-transport-https you have installed came from Debian 9, and the version of apt you propose to install is from Debian 11. Neither is appropriate for your Debian 10 system. apt-transport-https was deprecated in Debian 10 as its functionality is now included directly in apt.

You both need to remove apt-transport-https and get the correct version of apt for Debian 10.

You said that dpkg still works, so you should be able to use it to remove apt-transport-https. For example:

dpkg --purge apt-transport-https

After that you should be able to reinstall the correct apt package downloaded from as shown above.

dpkg --install apt_1.8.2.1_amd64.deb

Note that if you also deleted any of its dependencies, you will need to locate and install those first. An error message will tell you if this is necessary.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.