You are not logged in.
Hi guys,
this has been said probably somewhere around this place but I can't seem to find it.
I want to get rid of package, it's dependencies and pretty much all of its traces. I know that files in my home directory can't be tracked, so that would be my job to delete them. The wiki suggests the use of the "-Rsn" switch for complete removal, but I remember to read somewhere something about "-Rcs" for that job. The manpage doesn't quite clarify that, but I believe that both of these commands can be used for the job. Am I right?
Are there any differences whatsoever? The console output is absolutely the same. In both cases pacman would uninstall the same set of packages...
Would someone care to enlighten me?
Cheers,
ralle
Offline
As I understand the man page, the -s switch removes the stuff the package you specify depends on and which isn't needed by anything else, whereas the -c switch removes the stuff which itself depends on the package you want to remove. And the -n switch should function independent of those. I always used -Rsn, because I think pacman warns you if there actually are packages that depend on the package you want to remove, in which case I could remove those explicitly or with -c.
I'm a fairly new user, however, so I would be interested in any further clarification, too.
Cheers,
schwa
Offline
The manpage doesn't quite clarify that
REMOVE OPTIONS
-c, --cascade
Remove all target packages, as well as all packages that depend on one or more
target packages. This operation is recursive, and must be used with care since it
can remove many potentially needed packages.
-k, --keep
Removes the database entry only. Leaves all files in place.
-n, --nosave
Instructs pacman to ignore file backup designations. Normally, when a file is
removed from the system the database is checked to see if the file should be
renamed with a ".pacsave" extension.
-s, --recursive
Remove each target specified including all of their dependencies, provided that
(A) they are not required by other packages; and (B) they were not explicitly
installed by the user. This operation is recursive and analogous to a backwards
--sync operation, and helps keep a clean system without orphans. If you want to
omit condition (B), pass this option twice.
-u, --unneeded
Removes the targets that are not required by any other packages. This is mostly
useful when removing a group without using the -c option, to avoid breaking any
dependencies.
Are you sure that you read this section of the man page? "-n" removes files which would normally be backed up and "-c" removes all packages which depend on the target package. If you want to remove everything, use "-Rscn", which is equivalent to "-R -s -c -n".
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Actually I have a follow-up question, which I don't think the man page answers:
Does -Rscn also remove the unneeded dependencies of the packages that get recursively removed by the cascade switch?
Or, if order matters, would that be done by -Rcn -s?
Just realized, one could probably get the same result with the -u switch...
Last edited by schwa (2009-11-07 10:06:03)
Offline
You won't necessarily get the same result as -c will remove all depends (and possibly break something) whereas -u will only remove packages that are no longer needed.
All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.
Offline
Don't forget -Rssn and -Rcun I've found the later to be quite usefull a few times.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
...oh boy...
So if I get this right the answer for my question would be: "-Rsn" removes a package, as well as the dependecies which aren't needed anymore AND files that usually would have been backed up for some reason!
Now if I would add the "-c" to the mix, I could end up with a corrupted dependency tree right?
@Xine: Well, my statement "...doesn't clarify..." was wrong, sorry for that. It was just me not understanding.
I understand there's a plethora of switch combinations going on. Wouldn't it be wise to post a few scenarios to the pacman wiki for that reason? I would contribute myself, but as you all noticed I'm not the fittest with the topic. Installing stuff is quite straightforward but deleting could mess up your installation...
Cheers
Offline
From what loafer is suggesting, wouldn't '-Rcun' be optimum?
@Mr.Elendig - I don't understand what '-Rssn' does. Can you enlighten me?
Last edited by steve___ (2009-11-07 14:48:34)
Offline
From what loafer is suggesting, wouldn't '-Rcun' be optimum?
@Mr.Elendig - I don't understand what '-Rssn' does. Can you enlighten me?
@-Rssn: see man page under -s.
What I'm still unclear on is how one would go about removing the unneeded dependencies of _just_ the packages you would be removing with -Rsc. Or does the -s "recursivity" also pertain to the packages removed with -c, if one were to order it -Rc -s.
Last edited by schwa (2009-11-07 15:18:25)
Offline
Oh my ***, all these remove options are a HUGE mess, I want to remove them all
First a few clarifications :
* -c and -u are exclusive , it does not make any sense to use them together. -cu is equivalent to -c
* -cs or -sc = -c then -s
* the only safe operation is -s
Second, let's take an example of removing a group foo with two packages : foo1 and foo2
pacman -R foo
bar: requires foo1
do I care about bar ?
Yes : pacman -Ru foo -> will remove only foo2 because foo1 is required (by bar)
No : pacman -Rc -> will remove foo1, foo2, and all packages depending on them (bar)
On top of that, you can always use -s (it could even be the default behavior)
And that's it.
I don't recommend the usage of -ss because it can remove packages you installed explicitly , so you might want to keep them (if not, you can always look at -Qte list)
I don't recommend -n because pacman will only keep config files you modified, so you could lose your work. It seems much safer to do a separate cleanup of .pacsave files in a second step.
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
First a few clarifications :
* -c and -u are exclusive , it does not make any sense to use them together. -cu is equivalent to -c
* -cs or -sc = -c then -s
* the only safe operation is -sSecond, let's take an example of removing a group foo with two packages : foo1 and foo2
pacman -R foo
bar: requires foo1
Thank you very much for your explanations.
So, when you say, -cs=-sc, I guess the -s only removes the dependencies of the _target_ packages (as stated in the man page), not the packages that are affected by -c.
To use your example: If foo1 required a foo1sub1 to work, that wouldn't be removed by "pacman -Rcs foo", unless foo1sub1 itself was also in the group foo.
edit: Wait, actually, I think it would be removed. I'm thinking of the following:
pacman -Rcs myfoo
where the group foo depends on myfoo, contains foo1 and foo2, and foo1 depends on foo1sub1, which is not a dependency of myfoo.
This, as I understand it, would remove myfoo + myfoo's dependencies (-s switch) and the packages in the group foo, _but_ not any other dependencies of the group that could now be unneeded.
Is that it?
Last edited by schwa (2009-11-07 16:25:18)
Offline
So, when you say, -cs=-sc, I guess the -s only removes the dependencies of the _target_ packages (as stated in the man page), not the packages that are affected by -c.
To use your example: If foo1 required a foo1sub1 to work, that wouldn't be removed by "pacman -Rcs foo", unless foo1sub1 itself was also in the group foo.
I think your example does not make much sense and is not related to your question
However if bar had a dependency barsub, then -Rcs would remove barsub too.
That's what I meant with "-c then -s" : -s applies also to all packages added by -c.
pacman -Rcs foo
->
-c : foo1 foo2 bar
-s : foo1 foo2 bar barsub
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
Thanks, that's exactly what I wanted to know.
Offline
...glad to have a pacman developer on this thread. Honestly I'm really really confused now. Correct me if I'm wrong but the problem with those theoretical expamples is that you can't tell if a subdependency was installed explicitly by the user or as a dependency by some other package.
Let's sum it up (if we can) ...
1. I want to delete a package with all the dependecies WHICH AREN'T USED BY ANY OTHER PACKAGE ('cause I don't want to break other programs)
2. I don't want orphans (I think that is included in the first statement as well)
3. I understood by now that the "-n" makes sense in case of reinstalls etc
Let's hear it...
Offline
Good explanation shining. -Rcs is always what I used and does the job well.
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
-Rcs is always what I used and does the job well.
I don't understand why you would _always_ use -Rcs. Shouldn't -Rs do the job most of the time, and if it doesn't because there are packages dependent on the one to be removed, wouldn't it be better to get warned explicitly about it by pacman, instead of it just adding them to the remove list, where you could easily overlook them (e.g. when removing a group)?
Could be, of course, that I'm missing something here due to my already mentioned low arch mileage.
Offline
1. I want to delete a package with all the dependecies WHICH AREN'T USED BY ANY OTHER PACKAGE ('cause I don't want to break other programs)
2. I don't want orphans (I think that is included in the first statement as well)
This is simply -Rs
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
I don't understand why you would _always_ use -Rcs. Shouldn't -Rs do the job most of the time, and if it doesn't because there are packages dependent on the one to be removed, wouldn't it be better to get warned explicitly about it by pacman, instead of it just adding them to the remove list, where you could easily overlook them (e.g. when removing a group)?
Could be, of course, that I'm missing something here due to my already mentioned low arch mileage.
I don't know if some people use -Rc or -Rcs right away, but I definitely wouldn't recommend it
And now I just remember something from earlier : all these options do not break dependencies.
Only -Rd does. You can check any dep breakage with 'testdb'
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
Never had a problem with -Rcs so pacman is doing good. Tested -Rs and -Rcs on various packages and both were removing the same content. Will use -Rs from now on.
Thanks shining.
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
That's a wrap, let's call it a day!! Thx to everyone for the constructive input...
(removed the SOLVED because there's more to come...)
go on guys...
Last edited by ralle (2009-11-07 21:45:21)
Offline
After today I'm switching to -Rs, too (from -Rsn).
But to exhaust our topic "complete removal" once and for all:
I know there is -Sc and -Scc to empty the pacman cache, but they only seem to work globally and therefore would also remove packages from the cache one might want to keep.
So is there a way to tell pacman to remove the cache packages at "removal time" for just the target packages?
Obviously one could just delete them manually, but that seems a bit tedious for larger package groups.
Oops, saw your post too late, ralle.
Well, I got enough disk space anyway, so never mind
Last edited by schwa (2009-11-07 21:14:37)
Offline
Going back to -Rcs. Never had a problem with it and discovering -Rs isn't discovering some dependencies. I could use pacman -Qtd afterword but I'm too lazy to remember it. :^)
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline