how do I get apt-get to completely uninstall a package?
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how do I get apt-get to completely uninstall a package?
How do I get apt-get to completely uninstall a package?
When you use the command apt-get remove <package> it removes that package from the system but leaves behind config files for that package. How do you get apt-get to remove EVERYTHING when it removes the package?
Here's the case. I used apt-get to remove a package I though I would no longer use. Some time went by and it looke like I was done with it so I manually deleted the config files for that package just to clean up the drive. Some time went by and I needed to use that package again so I used apt-get to install it again. The 2nd time around the package does not have nor generate the config files. I'm assuming since it was installed once it expected them to be there and did not make them this time.
How do I get a total uninstall with apt-get? So when that above situation happens the reinstalled package will be complete by making the configs again.
Re: how do I get apt-get to completely uninstall a package?
Quote:
Originally posted by muxman How do I get apt-get to completely uninstall a package?
When you use the command apt-get remove <package> it removes that package from the system but leaves behind config files for that package. How do you get apt-get to remove EVERYTHING when it removes the package?
apt-get --purge remove <package>
Quote:
Here's the case. I used apt-get to remove a package I though I would no longer use. Some time went by and it looke like I was done with it so I manually deleted the config files for that package just to clean up the drive. Some time went by and I needed to use that package again so I used apt-get to install it again. The 2nd time around the package does not have nor generate the config files. I'm assuming since it was installed once it expected them to be there and did not make them this time.
You should never remove files by hand use dpkg --purge <package> if you have already removed it with apt plus the files by hand and it thinks it is still configured this should get rid of it.
Quote:
How do I get a total uninstall with apt-get? So when that above situation happens the reinstalled package will be complete by making the configs again.
See above and try apt-get --reinstall install <package> to see if it helps if not the dpkg --purge then reinstall.
muxman:
you are right, 'apt-get remove' does not do the job throughly, the solution to your problem, IMHO, can be solved this way, which is what i do in order to remove everything pertaining to the package in question:
apt-get install deborphan debfoster
#apt-get remove --purge package
#apt-get clean
the later will clean the /var
#debfoster
will show files and libraries still left after the apt-get remove --purge, if you don't recognize a library, keep it, later on, deborphan will give you a list of 'orphaned' libraries that are hanging with no use, and are safe to nuke.
if you make a mistake with debfoster, type 'u' and will ask you again if you want to keep it. When you are thru with it, invoke deborphan.
#deborphan
will give a list of libraries that are hanging just taking space, to get rid of them:
#deborphan | xargs apt-get -y remove purge
when thru with that:
#apt-get clean
recently after a dist-ugrade to sid, it installed emacs21, i removed it, and debfoster found some files like emacsen, etc.
now, i don't know if dpkg --purge is any better, i should try that sometime.
then opened the resulting file and removed the "deinstalled" line from each entry (used find deinstall and replace *blank*, there were a couple hundred packages). Finally:
cat tobepurged | xargs sudo dpkg -P
It worked fine for me and most important.. it didn't purge active packages!
Hope to hear some suggestions and ways to make it better. It's the first time I post an original solution (I understand it's very basic...) of mine on a linux forum.
Last edited by JohnnyHead; 03-07-2010 at 09:09 AM.
muxman:
you are right, 'apt-get remove' does not do the job throughly, the solution to your problem, IMHO, can be solved this way, which is what i do in order to remove everything pertaining to the package in question:
apt-get install deborphan debfoster
#apt-get remove --purge package
#apt-get clean
the later will clean the /var
Had never heard of apt-get clean, so never used it before. Manual said it should be run occasionally to free up disk space. Get this:
Hang on. It's just got rid of /var/cache/apt/archive/* has it? Not so surprising then, and presumably debian.org would not like it because it increases their bandwidth?
I update my ubuntu using "sudo apt-get update".
I got the follwoing error. Some index files failed to download. They have been ignored, or old ones used instead.
Is there any way to restore or remove the packages that have been updated using "sudo apt-get update" command. Like as in windows, can i restore my ubuntu or remove the installed packages. Its not about removing a specific package. About all the packages that have been installed using sudo apt-get update comman.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
# 9 .
If you are still using Ubuntu 11.04 :
"11.04" was moved to the 'old archive' some months ago.
You can replace '/etc/apt/sources.list' with this :
Code:
deb http://old-releases.ubuntu.com/ubuntu/ natty main restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-updates universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-security universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-backports main restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-backports universe multiverse
update
update is used to resynchronize the package index files from their sources. The indexes of available packages
are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive,
this command retrieves and scans the Packages.gz files, so that information about new and updated packages is
available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the
overall progress meter will be incorrect as the size of the package files cannot be known in advance.
On Debian there's /var/cache/apt/archives/, I expect Ubuntu is similar.
For specific package versions I use http://snapshot.debian.org
Maybe you should start your own thread in the Ubuntu section to get accurate responses.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.