10

I accidently removed apt-get from my Debian system by issuing:

dpkg --force-depends --purge apt

How can I reinstall it?

2
  • 1
    This is why the --force-* options should only be used exceptionally sparingly, even if you think you know what you're doing... Speaking of which, why did you feel the need to remove apt?
    – Shadur
    Nov 30, 2011 at 18:14
  • apt didnt work any more... I tried to install anything but it didn't work, I got some strange errors. (can't remember which one, I think it said something like "E:small apt database, try to increase the cache" or something) I reinstalled apt and it works now.
    – MilMike
    Nov 30, 2011 at 18:30

2 Answers 2

15

ok, I reinstalled it! just downloaded the deb package and used dpkg to install it.:

dpkg -i apt_0.7.20.2+lenny2_amd64.deb
5
  • 1
    Thanks for answering your own question. Could you maybe share the dpkg command used, please?
    – rahmu
    Nov 30, 2011 at 13:18
  • 1
    Did you use dpkg -i foobar.deb?
    – znarf
    Nov 30, 2011 at 16:41
  • I just edited my answer and added the dpkg command.
    – MilMike
    Nov 30, 2011 at 17:01
  • 1
    That link is broken now. But you can still find the list of available apt distributions by going here
    – Greg
    Jul 10, 2015 at 22:23
  • @Greg After almost three years, I've now edited the answer to include the correct link. May 11, 2018 at 20:41
3

This link has debian packages for all apt versions that were in a Debian release: ftp://archive.debian.org/debian/pool/main/a/apt/

First install libapt-pkg for the version you need and then install the apt package for your system using dpkg -i.

In case of conflicts, look for apt packages in dpkg -l and uninstall it using dpkg -r. After this use the above step to reinstall apt.

2
  • I edited it from Ubuntu to the Debian URL. "All known apt versions" is not true. Jul 24, 2015 at 0:24
  • 1
    In case of conflicts, it means you installed the wrong version of something. Don't uninstall what's already there, instead install the correct version of what was removed. Jul 24, 2015 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.