You are not logged in.

#1 2009-11-07 09:01:57

ralle
Member
From: Hannover
Registered: 2009-04-25
Posts: 20

pacman -Rsn vs. -Rcs for complete removal?

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

#2 2009-11-07 09:39:04

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

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

#3 2009-11-07 09:49:05

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 6,628
Website

Re: pacman -Rsn vs. -Rcs for complete removal?

ralle wrote:

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2009-11-07 10:02:00

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

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

#5 2009-11-07 10:22:27

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: pacman -Rsn vs. -Rcs for complete removal?

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

#6 2009-11-07 12:38:07

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,068

Re: pacman -Rsn vs. -Rcs for complete removal?

Don't forget -Rssn and -Rcun  I've found the later to be quite usefull a few times.


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2009-11-07 13:33:29

ralle
Member
From: Hannover
Registered: 2009-04-25
Posts: 20

Re: pacman -Rsn vs. -Rcs for complete removal?

...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

#8 2009-11-07 14:47:55

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: pacman -Rsn vs. -Rcs for complete removal?

From what loafer is suggesting, wouldn't '-Rcun' be optimum?

@Mr.Elendig - I don't understand what '-Rssn' does.  Can you enlighten me?  smile

Last edited by steve___ (2009-11-07 14:48:34)

Offline

#9 2009-11-07 15:11:37

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

steve___ wrote:

From what loafer is suggesting, wouldn't '-Rcun' be optimum?

@Mr.Elendig - I don't understand what '-Rssn' does.  Can you enlighten me?  smile

@-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

#10 2009-11-07 15:59:59

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman -Rsn vs. -Rcs for complete removal?

Oh my ***, all these remove options are a HUGE mess, I want to remove them all smile

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

#11 2009-11-07 16:19:47

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

shining wrote:

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

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

#12 2009-11-07 16:27:18

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman -Rsn vs. -Rcs for complete removal?

schwa wrote:

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 smile

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

#13 2009-11-07 18:18:06

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

Thanks, that's exactly what I wanted to know.

Offline

#14 2009-11-07 18:20:53

ralle
Member
From: Hannover
Registered: 2009-04-25
Posts: 20

Re: pacman -Rsn vs. -Rcs for complete removal?

...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) wink ...

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...

smile

Offline

#15 2009-11-07 18:40:05

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: pacman -Rsn vs. -Rcs for complete removal?

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

#16 2009-11-07 18:58:27

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

Gen2ly wrote:

-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

#17 2009-11-07 19:41:59

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman -Rsn vs. -Rcs for complete removal?

ralle wrote:

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

#18 2009-11-07 19:46:19

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman -Rsn vs. -Rcs for complete removal?

schwa wrote:

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 smile

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

#19 2009-11-07 20:20:52

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: pacman -Rsn vs. -Rcs for complete removal?

Never had a problem with -Rcs so pacman is doing good. smile  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

#20 2009-11-07 21:08:36

ralle
Member
From: Hannover
Registered: 2009-04-25
Posts: 20

Re: pacman -Rsn vs. -Rcs for complete removal?

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...)  wink

go on guys...

Last edited by ralle (2009-11-07 21:45:21)

Offline

#21 2009-11-07 21:13:46

schwa
Member
Registered: 2009-10-07
Posts: 18

Re: pacman -Rsn vs. -Rcs for complete removal?

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 smile

Last edited by schwa (2009-11-07 21:14:37)

Offline

#22 2009-11-09 18:54:08

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: pacman -Rsn vs. -Rcs for complete removal?

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

Board footer

Powered by FluxBB