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'
1 Answer
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:
- https://launchpad.net/ubuntu/+archive/primary/+files/apt-doc_0.9.7.5ubuntu5.4_all.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-pkg-doc_0.9.7.5ubuntu5.4_all.deb
On a 32-bit system (but not if you're running the 64-bit version of Ubuntu), get these files:
- https://launchpad.net/ubuntu/+archive/primary/+files/apt-transport-https_0.9.7.5ubuntu5.4_i386.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/apt-utils_0.9.7.5ubuntu5.4_i386.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/apt_0.9.7.5ubuntu5.4_i386.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-inst1.5_0.9.7.5ubuntu5.4_i386.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-pkg-dev_0.9.7.5ubuntu5.4_i386.deb (often optional, but no reason not to get it)
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-pkg4.12_0.9.7.5ubuntu5.4_i386.deb
On a 64-bit system (but not if you're running the 32-bit version of Ubuntu), get these files:
- https://launchpad.net/ubuntu/+archive/primary/+files/apt-transport-https_0.9.7.5ubuntu5.4_amd64.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/apt-utils_0.9.7.5ubuntu5.4_amd64.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/apt_0.9.7.5ubuntu5.4_amd64.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-inst1.5_0.9.7.5ubuntu5.4_amd64.deb
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-pkg-dev_0.9.7.5ubuntu5.4_amd64.deb (often optional, but no reason not to get it)
- https://launchpad.net/ubuntu/+archive/primary/+files/libapt-pkg4.12_0.9.7.5ubuntu5.4_amd64.deb
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
sudo apt-get purge
should do nothing by itself. Did you specify any packages afterpurge
?apt
and related packages have apparently been uninstalled. The solution is to manually download all the necessary.deb
package files and install them withdpkg
. What files are needed depends on which Ubuntu release you have. What version of Ubuntu are you running?