LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-02-2004, 01:13 AM   #1
muxman
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 203

Rep: Reputation: 32
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.
 
Old 10-02-2004, 01:33 AM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
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.
 
7 members found this post helpful.
Old 10-02-2004, 08:05 AM   #3
macondo
Senior Member
 
Registered: Jul 2003
Location: Central America
Distribution: Slackwre64-current Devuan
Posts: 1,034

Rep: Reputation: 62
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.

Last edited by macondo; 10-02-2004 at 08:10 AM.
 
5 members found this post helpful.
Old 10-02-2004, 06:24 PM   #4
muxman
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 203

Original Poster
Rep: Reputation: 32
Great suggestions guys. Those are just what I'm looking for and I'll be putting this knowledge to use.

Thanks!
 
Old 03-07-2010, 09:08 AM   #5
JohnnyHead
LQ Newbie
 
Registered: Dec 2009
Distribution: Karmic
Posts: 2

Rep: Reputation: 1
Hi! I too wanted to purge my machine throughly from old uninstalled packages... I have ubuntu karmic.

I used this simple trick:

dpkg --get-selections | grep deinstall > tobepurged

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.
 
1 members found this post helpful.
Old 03-07-2010, 11:04 AM   #6
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,884
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
aptitude purge ~c
apt-get autoremove

Also you do not need the "remove" when doing apt-get remove --purge package, just apt-get purge package.

deborphan | xargs apt-get -y remove --purge

To remove all orphaned data packages run:

deborphan --guess-dev | xargs apt-get -y remove --purge

To see all the orphaned packages on your system run:

deborphan --guess-all
 
1 members found this post helpful.
Old 03-07-2010, 11:10 AM   #7
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
You can also, to completely remove not just the package but all of its dependencies, use "sudo apt-get autoremove" with the --purge flag.
 
Old 03-07-2010, 11:57 AM   #8
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Quote:
Originally Posted by macondo View Post
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:
Code:
fido# df -h   
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              12G  9.2G  1.8G  84% /
tmpfs                 2.0G  8.0K  2.0G   1% /lib/init/rw
udev                   10M  184K  9.9M   2% /dev
tmpfs                 2.0G   12K  2.0G   1% /dev/shm
/dev/sda1             2.7G  2.1G  599M  79% /dos
/dev/sda6             212G  151G   51G  75% /home
fido# apt-get clean
fido# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              12G  7.4G  3.6G  68% /
tmpfs                 2.0G  8.0K  2.0G   1% /lib/init/rw
udev                   10M  184K  9.9M   2% /dev
tmpfs                 2.0G   12K  2.0G   1% /dev/shm
/dev/sda1             2.7G  2.1G  599M  79% /dos
/dev/sda6             212G  151G   51G  75% /home
fido#
An astonishing reduction in the disk space used.

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?
 
Old 02-23-2013, 04:54 AM   #9
s4sarath
LQ Newbie
 
Registered: May 2010
Posts: 22

Rep: Reputation: 0
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.

thanks guys.
 
Old 02-23-2013, 05:08 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 9.

No packages are installed at $ sudo apt-get update

"apt-get update" is updating the "available packages list" only.

? ? Which Ubuntu version is it about : $ cat /etc/issue

-
 
Old 02-23-2013, 05:19 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 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
 
1 members found this post helpful.
Old 02-23-2013, 05:38 AM   #12
s4sarath
LQ Newbie
 
Registered: May 2010
Posts: 22

Rep: Reputation: 0
Im using ubuntu 12.10. What you mean by "updating the packages list"? Didnt it update the old files? Thankssssss
 
Old 02-23-2013, 06:04 AM   #13
yowi
Member
 
Registered: Dec 2002
Location: Au
Distribution: Debian
Posts: 209

Rep: Reputation: 55
As far as update goes the man page is helpful:
Quote:
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.
Ubuntu's docs may help:
https://help.ubuntu.com/community/SoftwareManagement
 
1 members found this post helpful.
Old 02-23-2013, 06:04 AM   #14
s4sarath
LQ Newbie
 
Registered: May 2010
Posts: 22

Rep: Reputation: 0
Is there any default repository folder, which holds the deb package of downloaded files inside ubuntu?
 
Old 02-23-2013, 07:16 AM   #15
yowi
Member
 
Registered: Dec 2002
Location: Au
Distribution: Debian
Posts: 209

Rep: Reputation: 55
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
latex2e package unavailable in package manager or apt-get cesine Debian 2 07-11-2006 02:31 PM
how do I completely uninstall IE ddaas General 17 01-20-2005 06:21 PM
How do i COMPLETELY uninstall Linux and GRUB? Lambas Linux - Newbie 10 11-09-2004 07:37 AM
HELP with apt-getHow come when I tried to use apt-get to remove a package to regain redss Linux - Newbie 1 08-22-2004 11:59 PM
Does apt-get install <package> upgrade the package if it is already installed? davidas Debian 4 04-05-2004 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration