I have accidentally removed apt-get, how do I reinstall it?

$ sudo apt-get update
sudo: apt-get: command not found

$ sudo dpkg-reconfigure apt
/usr/sbin/dpkg-reconfigure: apt is broken or not fully installed 

I would like to mention I do not want to reinstall Linux!

  • Can you check exactly which packages you uninstalled? And provide a list of them in your question. – user364819 May 21 '15 at 11:33
  • I do not know how to do that...and I upgraded some lib(something) after, as I read on here a little about it and I tried to fixed it. – privateoneuser May 21 '15 at 11:36
  • 1
    Please edit your question to add the list of packages you uninstalled. You'll find that in cat /var/log/apt/history.log | grep remove, if you removed it using apt-get remove. If you used the purge command, replace the grep string accordingly. If you did it differently, just output the log file. – s3lph May 21 '15 at 11:38
  • I cannot put the output as it exceeds alot the number of charachters. Is there a way I can attached the file? – privateoneuser May 21 '15 at 11:45
  • First part is : Start-Date: 2015-05-18 22:05:40 Commandline: /usr/sbin/synaptic Purge: account-plugin-aim:i386 (3.8.6-0ubuntu9.1) End-Date: 2015-05-18 22:05:42 – privateoneuser May 21 '15 at 11:52

I'm not sure what happened with your apt-get, but if you're unable to use it, you might want to use apt from Ubuntu repositories (simply downloading and installing via sudo dpkg -i package_name)

the functionality of apt is pretty much similar to what you get with apt-get.

  • user3@comp3:~/Downloads$ sudo dpkg -i apt_1.0.1ubuntu2.5_i386.deb (Reading database ... 350313 files and directories currently installed.) Preparing to unpack apt_1.0.1ubuntu2.5_i386.deb ... Unpacking apt (1.0.1ubuntu2.5) over (0.5.15-2) ... dpkg: dependency problems prevent configuration of apt: apt depends on libapt-pkg4.12 (>= 0.9.16); however: Package libapt-pkg4.12:i386 is not configured yet. apt depends on libstdc++6 (>= 4.6); however: Package libstdc++6:i386 is not configured yet. – privateoneuser May 21 '15 at 12:32
  • dpkg: error processing package apt (--install): dependency problems - leaving unconfigured Processing triggers for man-db ( ... Errors were encountered while processing: apt – privateoneuser May 21 '15 at 12:33
  • 1
    Have you tried installing the packages that were mentioned as not configured? – Paulius Šukys May 21 '15 at 12:34
  • I tried to install some of them, yes but it always kept saying that this package is not yet configured because another package that depends on is not configured yet and so on, until I gave up. Unfortunally I removed too many packages and now I am stuck. – privateoneuser May 21 '15 at 12:39
  • The depends list is not so big, do the same for all of these, repeat in cycle if needed, you should get apt-get back again: libapt-pkg4.12 (>= 0.9.16), libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.6), ubuntu-keyring, gnupg. – Stéphane Gourichon May 21 '15 at 13:40

Assuming that your apt-get seriously needs a reinstall, you can try following:

  1. Check your current apt-get version by apt-get --version.
  2. Search for the same version's .deb file on launchpad.net
  3. install it by dpkg -i filename.deb
  4. Of course, this unfortunately cannot work if you also removed the packeges on which apt depends, like libgcc1
  • user3@comp3:~$ apt-get --version bash: apt-get: command not found – privateoneuser May 21 '15 at 12:08
  • @privateoneuser, which ubuntu version are you using? For 15.04, it is apt try installing this version, I don’t think ubuntu version will matter. Download deb file corresponding to your architecture – GunjanPB May 21 '15 at 12:16
  • user3@comp3:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.2 LTS Release: 14.04 Codename: trusty – privateoneuser May 21 '15 at 12:21
  • Go to (launchpad.net/ubuntu/+source/apt/1.0.1ubuntu2.7) and select your architecture (amd64/i386 etc.) and download apt_<version><architecture>.deb – GunjanPB May 21 '15 at 12:35
  • I downloaded apt_1.0.1ubuntu2.7.tar.xz and apt_1.0.1ubuntu2.7.dsc. Should I install these 2 packages? – privateoneuser May 21 '15 at 12:42

Try installing synaptic from the command line, and see if you can't reinstall apt that way.

From a terminal window, type in the following:

wget http://mirrors.kernel.org/ubuntu/pool/universe/s/synaptic/synaptic_0.84.2_amd64.deb

then install the downloaded package:

sudo dpkg -i synaptic_0.84.2_amd64.deb

then run the installed app:

sudo synaptic

In the quick search, type in apt and select it for install.

  • I successfully installed synaptic using Sofware Center for i686. Thank you a lot for your help. – privateoneuser May 21 '15 at 14:29

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.