Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I did the command sudo apt-get purge and all my apt- commands and my software center are no longer installed. when ever i do 'sudo apt-get update' even, i get 'sudo: apt-get: command not found'

share|improve this question
1  
Can you post the console log when you try to apt-get install something in your answer for us, so we can see what's happening, please? –  Tim Fothergill Apr 4 '13 at 23:02
1  
Also, sudo apt-get purge should do nothing by itself. Did you specify any packages after purge? –  Eliah Kagan Apr 4 '13 at 23:12
    
My commands: 'sudo apt-get install libusb-dev libusb-0.1-4' & 'sudo apt-get purge libusb-dev libusb-0.1-4 – user146881 22 mins ago –  user146881 Apr 5 '13 at 0:10
    
apt and related packages have apparently been uninstalled. The solution is to manually download all the necessary .deb package files and install them with dpkg. What files are needed depends on which Ubuntu release you have. What version of Ubuntu are you running? –  Eliah Kagan Apr 5 '13 at 0:18
    
i''m runnign ubuntu 12.10 –  user146881 Apr 5 '13 at 0:32
show 2 more comments

1 Answer 1

up vote 1 down vote accepted

You don't have APT installed, so you can't automatically download and install any packages. That includes the packages you need to put APT back. Therefore, you must manually install them.

The best place to get them is probably here on Launchpad, since the interface is easy to use and the downloads are encrypted over HTTPS (which means you're far less likely to get corrupted files).

On the page for the apt source package on Launchpad, find your release. There may be more than one entry under it that can be expanded. Expand the entry that says updates if there is one. If not, expand the entry that says security if there is one. If not, expand the entry that says release.

In this case, the entry to expand is (therefore) 0.9.7.5ubuntu5.4, which says updates, security (main) next to it.

Then download all the .deb files for your architecture:

  • Get all files whose names end in _all.deb.
  • If you have a PC or Intel Mac with a 32-bit processor, get all files whose names end in _i386.deb.
  • If you have a PC or Intel Mac with a 64-bit processor (even if it is an Intel processor), get all files whose names end in _amd64.deb.

Download the files to a folder that has no other files in it. You'll probably make a new folder for this purpose.

You can actually skip the apt-doc and libapt-pkg-doc packages if you like, as it provides documentation that's not necessary for running APT. I recommend going ahead and getting them, though.

The following is for your convenience (and that of others with this problem who are running Ubuntu 12.10, as many people currently are). Following the above instructions will work fine. If you like, you can download the packages using the links below, which are taken directly from that Launchpad page.

If you want apt-doc and apt-pkg-doc, download them here:

On a 32-bit system (but not if you're running the 64-bit version of Ubuntu), get these files:

On a 64-bit system (but not if you're running the 32-bit version of Ubuntu), get these files:

With all the downloaded .deb files in one folder, go into the folder in the Terminal.

For example, if you put them in a folder called debs in your home directory, you'd open a Terminal window (Ctrl+Alt+T) and run:

cd ~/debs

This would put you in your debs folder. (~ represents your home folder.)

If the folder is elsewhere, you'll have to specify where. For example, if you put it inside the Downloads folder in your home folder:

cd ~/Downloads/debs

If you prefer, you can simply type cd (with the space at the end), don't press Enter yet, but drag the folder from Nautilus (the file browser) into the Terminal. This will paste its full path. Then you can press Enter to go there.

Once you are in the folder that contains the .deb files you downloaded, run this command:

sudo dpkg -i *

That will install them all. That should restore APT and you should be able to install packages in the usual way again. (If you are accustomed to using the Software Center, and that's also uninstalled, then you can get that back with sudo apt-get update && sudo apt-get install software-center.)

If you get errors when you run that dpkg command, please post a comment and also update your question with all the text from the Terminal. If it says there are unsatisfied dependencies, you might try to find those yourself on Launchpad, but feel free to ask for help.

Assuming this works, you should reinstall libusb-0.1-4 followed by ubuntu-desktop (assuming this is a vanilla Ubuntu system and not, say, Kubuntu, Xubuntu, or Lubuntu).

To install libusb-0.1-4 (assuming you've already run sudo apt-get update):

sudo apt-get install libusb-0.1-4

Then to install ubuntu-desktop (to restore other packages that got removed):

sudo apt-get install ubuntu-desktop
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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