Reputation: 1059
Newbie to linux, I thought that apt-get purge
is usually used to remove a pkg totally, but today it neally crash my whold system. I want to remove a previously installed python 3.4
distribution, but I'm not sure which pkg it belongs, so I used find /usr -type f -name "python3.4"
to find it, the command returns several lines, the first one is /usr/bin/python3.4
, so then I typed dpkg -S /usr/bin/python3.4
to determine which pkg python3.4 belongs, it returns python-minimal
, so I typed sudo apt-get purge python-minimal
, but then a lot of pkgs was removed, also some installed, I'm totally confused, and I saw even the app store disappeared, a lot of the system was removed... Can someone help me?
Upvotes: 0
Views: 4081
Reputation: 9065
I will share a most convenient way of finding what command/file belongs to what package in the system
sudo apt-get install apt-file
sudo apt-file update
# which python
sudo apt-file find bin/python
I am using Debian, but above method could help with Ubuntu, I think
Note the searching path bin/python
didn't have to be a full path could be a substring of the real path, as every Debian package will put executable in a bin/
folder, it's very convenient to find with bin/CommandName
Upvotes: 1
Reputation: 23035
When you run apt purge <package>
or apt remove <package>
you are not only instructing apt
to remove the named package, but any other package that depends on it. Of course apt
doesn't perform that unexpected operation without first asking for your consent, so I imagine it showed the list of packages that it was going to remove, and when you pressed Y
it removed all of them.
So, to undo the mess, if you still have the window where you run the purge
then check which packages it told you it was going to remove, and manually apt install
them. If you don't have the list around, then you need to manually install every package that is not working properly.
If it is the window manager that got damaged, try apt-get install ubuntu-gnome-desktop
or the appropriate package for your distribution/window manager.
Rule of thumb when deleting/updating packages: always read the list of packages affected, sometimes there is unexpected stuff.
Upvotes: 3