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 05-03-2009, 01:13 AM   #1
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Rep: Reputation: 15
Aptitude remove or purge <packagename> not working


I have always used aptitude very simply from the command line to update, upgrade, remove and purge packages.

I wanted to remove cherokee and start again with it so I did:

Code:
aptitude remove cherokee
and

Code:
aptitude purge cherokee
One of those commands (can't remember which) said it couldn't remove a directory (think it was /etc/cherokee) because it wasn't empty, which I thought a bit odd.

So I did:

Code:
locate cherokee
and found a whole bunch of cherokee files and folders in various places in the system. I've looked at the man page for aptitude and as far as I can make out, "remove" and "purge" should do what I want. That is, completely remove from the sytem, all traces of cherokee or any other package.

Am I misunderstanding something here or is there something else I need to be doing to uninstall a package?

Cheers.
 
Old 05-03-2009, 03:10 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Quote:
Originally Posted by mirror_man View Post
One of those commands (can't remember which) said it couldn't remove a directory (think it was /etc/cherokee) because it wasn't empty, which I thought a bit odd.

Cheers.
That message is quite normal. aptitude will always warn you about non-empty folders and will leave them alone. If you're sure there's nothing of value in the /etc/cherokee folder you can try emptying it manually (maybe make a backup of it just to be safe) and run the purge command again. That should wipe out the /etc/cheroke [now empty] folder. If nothing bad happens for a day or two, you can then delete the backup you made.
cheers,
jdk
 
Old 05-03-2009, 05:43 PM   #3
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jdkaye View Post
That message is quite normal. aptitude will always warn you about non-empty folders and will leave them alone. If you're sure there's nothing of value in the /etc/cherokee folder you can try emptying it manually (maybe make a backup of it just to be safe) and run the purge command again. That should wipe out the /etc/cheroke [now empty] folder. If nothing bad happens for a day or two, you can then delete the backup you made.
cheers,
jdk
I've made a copy of all the cherokee folders and files I found and then deleted them by hand; purge didn't do it.

My main question is: why doesn't aptitude do it when I ask it to? Is there something else I should be doing or understanding to make it work as expected?
 
Old 05-03-2009, 11:21 PM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
I think it is possible for more than one package to use the same folder or else some folders may be manually altered for various reasons. aptitude seems to want to err on the side of caution. It informs you of the state of affairs (this folder is not empty) and then lets you decide what to do about it.
Cheers,
jdk
 
Old 05-04-2009, 07:08 AM   #5
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
Quote:
Originally Posted by mirror_man View Post
My main question is: why doesn't aptitude do it when I ask it to? Is there something else I should be doing or understanding to make it work as expected?
It doesn't do what you ask it to because you aren't asking it to do what you think you are. When you read the word 'purge', you think it means "remove everything - including non-empty folders related to this application." But aptitude is not built to do that. As Jdkaye explained, aptitude errs on the side of caution. You can file a wishlist bug, if you would prefer it to work a different way (perhaps request an 'uber-purge' command), but as things stand, this is what it does. (I agree that the aptitude manual might be a bit clearer about what 'purge' will or won't remove.)
 
Old 05-04-2009, 07:24 AM   #6
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Rep: Reputation: Disabled
Quote:
It doesn't do what you ask it to because you aren't asking it to do what you think you are.
offtopic: is there allready a liscence on that sentence? :-), that gave me a bit to think about. greetings.
 
Old 05-04-2009, 06:26 PM   #7
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jdkaye View Post
I think it is possible for more than one package to use the same folder or else some folders may be manually altered for various reasons. aptitude seems to want to err on the side of caution. It informs you of the state of affairs (this folder is not empty) and then lets you decide what to do about it.
Cheers,
jdk
Well, I guess it's a good thing in general to be cautious and I've noticed this behaviour before. In this instance, aptitude left pretty much everything in place. For example, single files in /usr/lib and /var/lib/dpkg/info and folders and files in /usr/share. Aptitude (can't remember if it was the remove or purge command) only told me about the folder in /etc though; I had to manually find all the other stuff.

Although I have installed quite a few packages from source and the odd .deb package installed with dpkg, cherokee was installed with aptitude and I kind of expected it to be cleanly uninstalled. Maybe letting aptitude have it's way and then do a hunt-and-delete operation is the way to go, although doing that could have it's problems too.

Oh well, guess I'll just keep expanding the size of /.



Thanks.
 
Old 05-04-2009, 06:46 PM   #8
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Rep: Reputation: Disabled
try:
Quote:
aptitude search ~c
Quote:
aptitude purge ~c
(first shows whats left over, second purges it, before ~c is free space)
greetings

Last edited by j1alu; 05-04-2009 at 06:58 PM.
 
Old 05-04-2009, 07:38 PM   #9
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Telemachos View Post
It doesn't do what you ask it to because you aren't asking it to do what you think you are. When you read the word 'purge', you think it means "remove everything - including non-empty folders related to this application." But aptitude is not built to do that. As Jdkaye explained, aptitude errs on the side of caution. You can file a wishlist bug, if you would prefer it to work a different way (perhaps request an 'uber-purge' command), but as things stand, this is what it does. (I agree that the aptitude manual might be a bit clearer about what 'purge' will or won't remove.)
That is exactly what I thought, with one proviso. That 'purge', would remove everything related to a particular application that 'remove' had left behind, as long as no other program depends on those items being in place. If aptitude does not do that, then it seems to me that there is no way to automatically and safely uninstall a program and its related files and folders. An 'uber-purge' (ie. don't check, just delete this stuff) command would be fine in the case of cherokee (or any other program and its related files and folders that nothing else depends on) because I don't think that anything else depends on its related files and folders being there, but such a command would still really need to check for dependancies or it would sometimes break things.

Hang on, that's what I think 'purge' should do. But it seems then, that it doesn't. Clearly it does do some form of checking, but perhaps only to the extent of:

Oh, 'remove' has left some stuff behind so I'll leave it alone too.

Maybe it's just too difficult to check everything like that; I don't know. Hmm...

Cheers.
 
Old 05-04-2009, 08:48 PM   #10
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by j1alu View Post
try:

aptitude search ~c

aptitude purge ~c

(first shows whats left over, second purges it, before ~c is free space)
greetings
That seems like it might work but when I do:

Code:
aptitude search ~cherokee
it does not find the cherokee files I left in /usr/share/doc and only one file of the several that are in /var/cache/apt/archives.

Maybe it would have found more if I hadn't already removed then manually. I will try that next time I want to uninstall something.

Cheers.

Last edited by mirror_man; 05-04-2009 at 08:53 PM.
 
Old 05-04-2009, 09:49 PM   #11
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Rep: Reputation: Disabled
did you also try exactly
Quote:
aptitude search ~c
? greetings
 
Old 05-05-2009, 05:53 AM   #12
oʌǝɹ
LQ Newbie
 
Registered: May 2009
Posts: 12

Rep: Reputation: 1
FIles created by package = { fixed files , conf files, files created during runtime }
As somebody said, folders may contain files from other packages. If only files from cherokee were in this directory and a apt-get remove did not remove {fixed files,files created during runtime} then it's a BUG in cherokee (similar to this)
Purge also removed conf files. You can get a list of configuration files with dpkg -s packagename and look at "conffiles"

You can probably create a bug report.

Or do you have problems with other packages, like your title says?
 
Old 05-05-2009, 07:35 PM   #13
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by j1alu View Post
did you also try exactly

Quote:
aptitude search ~c
? greetings
Yes, What is the purpose of the command?

It listed over 100 files but only one of them was related to cherokee.

Quote:
c libcherokee-config0 - Cherokee web server -Configuration librar
That is the same file that is listed when I did

Code:
aptitude search ~cherokee
 
Old 05-05-2009, 07:47 PM   #14
mirror_man
Member
 
Registered: Jan 2007
Distribution: Debian squeeze
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by oʌǝɹ View Post
FIles created by package = { fixed files , conf files, files created during runtime }
As somebody said, folders may contain files from other packages. If only files from cherokee were in this directory and a apt-get remove did not remove {fixed files,files created during runtime} then it's a BUG in cherokee (similar to this)
Purge also removed conf files. You can get a list of configuration files with dpkg -s packagename and look at "conffiles"
Ok, thanks for that. I'll install and remove - purge cherokee again and monitor what happens.

Quote:
Originally Posted by oʌǝɹ View Post
You can probably create a bug report.

Or do you have problems with other packages, like your title says?
Yes, I think I've noticed this before with other packages but those instances may have been examples of aptitude working as it should, ie. folders may have contained files from other packages. If it happens again I will investigate the situation to determine what is going on.

Cheers.
 
Old 05-06-2009, 07:09 AM   #15
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 60
Quote:
Originally Posted by mirror_man View Post
Yes, What is the purpose of the command? (aptitude search ~c)

It listed over 100 files but only one of them was related to cherokee
(A good reference for Aptitude's search terms.) The search parameter ~c
Quote:
Select[s] packages that were removed but not purged.
So, you have 100 packages that were removed but not purged. If you want to do something about that, you can also use it in commands like this:
Code:
aptitude purge ~c
When I want to purge things, I often do this
Code:
aptitude purge foobar && aptitude purge ~c
As I recall, aptitude purges the package foobar (as you ask it to), but it only removes foobar's dependencies. So if you want to recursively purge something (ie, purge it and purge its dependencies), you need to run aptitude purge ~c afterwards to catch the items that were removed but not purged. Perhaps that's (part of?) what happened to you?

Last edited by Telemachos; 05-06-2009 at 07:57 AM.
 
  


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
locating packages held with "aptitude hold <packagename>" farslayer Debian 3 12-01-2008 09:56 AM
aptitude- purge everything aquaboot Linux - Newbie 5 10-23-2007 08:53 PM
Use purge instead of remove in adept chandru.in Linux - Software 8 06-17-2007 12:55 AM
aptitude - auto-purge DennyB Debian 1 10-29-2005 08:56 AM
after 'apt-get remove --purge', it's still there (?) johnMG Debian 2 09-25-2003 08:54 AM

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

All times are GMT -5. The time now is 03:20 AM.

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