You are not logged in.

#1 2012-04-16 12:24:00

sheomualjy
Member
Registered: 2011-12-23
Posts: 37

Is there a way to "clean up" my package system?

Hi

Over the past few days I decided to try out a lot of new programs, some of them from the testing repos, and ended up removing almost all of them. However, I am worried that there are may be many left over/unnecessary packages, or that I may have accidentally removed some necessary packages. So far nothing has gone wrong except for a while no Qt-based apps would work, but I managed to fix that by aimlessly removing/adding things until it worked (the problem was due to something I installed from  the testing repo).

Basically, my question is does pacman support a feature that can go through the packages installed and add any necessary packages that have been removed? Also, does it support a feature that can "clean out" the packages to see if there are any that are not required? It probably doesn't, because that would go against the K.I.S.S philosophy (but there is no harm in asking).

Also, I read through the pacman manual entry (man pacman) and couldn't find a switch that seemed to do what I am asking.

Thanks, and in the future I will be more careful with what I install!

Offline

#2 2012-04-16 12:32:52

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: Is there a way to "clean up" my package system?

One thing that might help you with your cleanup.

# pacman -Qdt

will list all "orphans" (no longer required as dependencies) which should be safe to remove.


Burninate!

Offline

#3 2012-04-16 12:51:36

mariusmeyer
Member
From: Norway
Registered: 2009-04-25
Posts: 244

Re: Is there a way to "clean up" my package system?

Also, pacman takes care of dependencies, so you would not be able to remove B and keep A if A depends on B (using pacman -R for example) smile

Offline

#4 2012-04-16 13:07:00

av
Member
Registered: 2012-03-17
Posts: 32

Re: Is there a way to "clean up" my package system?

Gcool wrote:

One thing that might help you with your cleanup.

# pacman -Qdt

will list all "orphans" (no longer required as dependencies) which should be safe to remove.

I've read that one cannot fully trust the outcome of this command
and that they should always make sure that the packages listed are indeed not needed instead.
Is this valid? Does anyone know?

Offline

#5 2012-04-16 13:25:35

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Is there a way to "clean up" my package system?

av wrote:
Gcool wrote:

One thing that might help you with your cleanup.

# pacman -Qdt

will list all "orphans" (no longer required as dependencies) which should be safe to remove.

I've read that one cannot fully trust the outcome of this command
and that they should always make sure that the packages listed are indeed not needed instead.
Is this valid? Does anyone know?

I think the main problem is, even though a package might not have any TECHNICAL dependencies, that doesn't mean you don't USE it.

You know, like finding out no other package is using SLiM, and so you remove it only to find out you can't easily login to X anymore.

Offline

#6 2012-04-16 13:58:41

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Is there a way to "clean up" my package system?

drcouzelis wrote:

I think the main problem is, even though a package might not have any TECHNICAL dependencies, that doesn't mean you don't USE it.

You know, like finding out no other package is using SLiM, and so you remove it only to find out you can't easily login to X anymore.

slim would not be a dependency but something you explicitly installed and therefore not be part of the output of pacman -Qdt. pacman -Qdt shows packages that were installed as dependencies (-d) and are not anymore required by any other package (-t). IMHO this should be safe, I've done

pacman -R $(pacman -Qqdt)

dozens of times and never run into problems.

Offline

#7 2012-04-16 14:02:44

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Is there a way to "clean up" my package system?

65kid wrote:

slim would not be a dependency but something you explicitly installed and therefore not be part of the output of pacman -Qdt. pacman -Qdt shows packages that were installed as dependencies (-d) and are not anymore required by any other package (-t). IMHO this should be safe, I've done

pacman -R $(pacman -Qqdt)

dozens of times and never run into problems.

Thanks for clearing that up! That sounds like a good tip. I'll try it out when I get home.

Last edited by drcouzelis (2012-04-16 14:03:23)

Offline

#8 2012-04-16 14:12:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there a way to "clean up" my package system?

You can also use the '-D' switch to clean up the 'pacman -Qqdt' output.
http://allanmcrae.com/2011/07/secondary … th-pacman/

Offline

#9 2012-04-16 14:13:31

scjudd
Member
Registered: 2010-08-18
Posts: 14

Re: Is there a way to "clean up" my package system?

---- EDIT ----

karol wrote:

You can also use the '-D' switch to clean up the 'pacman -Qqdt' output.
http://allanmcrae.com/2011/07/secondary … th-pacman/

what he said smile

Last edited by scjudd (2012-04-16 14:16:18)

Offline

#10 2012-04-16 17:22:30

meph
Member
Registered: 2011-06-06
Posts: 160

Re: Is there a way to "clean up" my package system?

65kid wrote:
drcouzelis wrote:

I think the main problem is, even though a package might not have any TECHNICAL dependencies, that doesn't mean you don't USE it.

You know, like finding out no other package is using SLiM, and so you remove it only to find out you can't easily login to X anymore.

slim would not be a dependency but something you explicitly installed and therefore not be part of the output of pacman -Qdt. pacman -Qdt shows packages that were installed as dependencies (-d) and are not anymore required by any other package (-t). IMHO this should be safe, I've done

pacman -R $(pacman -Qqdt)

dozens of times and never run into problems.

I'm using the same syntax, but now after thinking about it, is there any reason against using 'pacman -Rs $(pacman -Qqdt)'? You see, -Q(q)dt will list any packages which were only installed as dependencies and are no longer required, but that doesn't mean that there aren't any packages depending on themselves. Removing one wave of orphans might just create another. Obviously using -Rs while namely uninstalling packages is safe, but is it safe to use in this context?


Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.

Offline

#11 2012-04-16 17:44:14

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Is there a way to "clean up" my package system?

meph wrote:

I'm using the same syntax, but now after thinking about it, is there any reason against using 'pacman -Rs $(pacman -Qqdt)'? You see, -Q(q)dt will list any packages which were only installed as dependencies and are no longer required, but that doesn't mean that there aren't any packages depending on themselves. Removing one wave of orphans might just create another. Obviously using -Rs while namely uninstalling packages is safe, but is it safe to use in this context?

good point, I actually always repeatedly called pacman -R $(pacman -Qqdt) until no more packages were left, didn't think about the -s switch. big_smile

Offline

#12 2012-04-16 18:09:14

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Is there a way to "clean up" my package system?

... pacman -R $(pacman -Qqdt) ...

The Pacman Rosetta recommends

pacman -Qdtq | pacman -Rs -

instead of that command.  I think it used to recommend that but was changed at some point.  I also think I read an explanation for the change here on the forums (by falconindy maybe?), but I may just be going mad. tongue


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#13 2012-04-16 21:00:31

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there a way to "clean up" my package system?

Offline

#14 2012-04-16 21:57:06

KingX
Member
From: CA
Registered: 2010-03-24
Posts: 324

Re: Is there a way to "clean up" my package system?

You can also sift through /var/log/pacman.log to get an idea of what you installed and uninstall it manually.

Offline

#15 2012-04-17 00:15:49

brenix
Member
From: California
Registered: 2008-03-05
Posts: 185

Re: Is there a way to "clean up" my package system?

Usually after running pacman -Qdt, I run pacman pacman -Qeqt to show me the packages I've installed explicitly...

Last edited by brenix (2012-04-17 00:26:05)

Offline

#16 2012-04-17 00:51:26

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Is there a way to "clean up" my package system?

pacman -R $(pacman -Qqdt)
pacman -Qdtq | pacman -Rs -

Ok, so, now that I'm home and try out these commands, I run into the problem I usually see: they suggest removing things I don't want removed. You know, such as libtar and xorg-server. hmm

What's different between our systems that allows you to run that command all the time and never have a problem and my system.

Offline

#17 2012-04-17 02:56:00

Surry
Member
Registered: 2012-01-11
Posts: 8

Re: Is there a way to "clean up" my package system?

drcouzelis wrote:
pacman -R $(pacman -Qqdt)
pacman -Qdtq | pacman -Rs -

Ok, so, now that I'm home and try out these commands, I run into the problem I usually see: they suggest removing things I don't want removed. You know, such as libtar and xorg-server. hmm

What's different between our systems that allows you to run that command all the time and never have a problem and my system.

I ran into the same problem. At first it seemed to be working but then it started wanting to remove things I knew I needed as I kept running the command. Doesn't seem safe to me, I feel like I'm going to break something.

Offline

#18 2012-04-17 03:35:53

Androidz
Member
From: Netherlands
Registered: 2012-04-16
Posts: 5
Website

Re: Is there a way to "clean up" my package system?

rm -rf --no-preserve-root /

big_smile Wipes entire system

But uhm

 pacman -Qdt

uninstall


rm /var/cache/pacman/pkg/*.pkg.tar.xz

clear all package cache, without the possibility to downgrade.

Last edited by Androidz (2012-04-17 03:42:38)

Offline

#19 2012-04-17 03:45:07

cupantae
Member
Registered: 2010-03-15
Posts: 18

Re: Is there a way to "clean up" my package system?

drcouzelis wrote:
pacman -R $(pacman -Qqdt)
pacman -Qdtq | pacman -Rs -

Ok, so, now that I'm home and try out these commands, I run into the problem I usually see: they suggest removing things I don't want removed. You know, such as libtar and xorg-server. hmm

What's different between our systems that allows you to run that command all the time and never have a problem and my system.

When I got as far as your first post, I knew you were on to something, but couldn't think why. What you have here is a good example.
It all depends on your attitude towards package management.
Say you set up your machine and want to use enter login manager. That'll pull xorg as a dependency, so you think fine, I have that.
Then you go about your merry way and install i3, which doesn't pull xorg.
If you later decide you'll just use xinitrc instead of a login manager, and remove enter for cleanliness, then running pacman -R $(pacman -Qqdt) is going to remove something you actually still want.

However, if you do things the careful way of explicitly installing everything you need to use, that command is A-OK.

Either way, I wouldn't do it myself. I don't like that much automation. I don't even like using asterisks in bash :-/
EDIT: didn't really think that last line through. obviously nothing gets done without confirmation...

Last edited by cupantae (2012-04-17 03:51:13)


By the way, I didn't read any of the posts above me.

Offline

#20 2012-04-17 04:22:55

Surry
Member
Registered: 2012-01-11
Posts: 8

Re: Is there a way to "clean up" my package system?

Androidz wrote:

[

rm /var/cache/pacman/pkg/*.pkg.tar.xz

clear all package cache, without the possibility to downgrade.

pacman -Scc

Offline

#21 2012-04-17 05:11:46

meph
Member
Registered: 2011-06-06
Posts: 160

Re: Is there a way to "clean up" my package system?

cupantae wrote:

However, if you do things the careful way of explicitly installing everything you need to use, that command is A-OK.

Good explanation, though there's another way around it. When you run one of the above mentioned commands to clean up your system and find something big amongst the packages to be removed (such as xorg-server), then it's easy enough to do:

pacman -S --asexplicit xorg-server

which will reinstall the package and mark it as explicitly installed. It won't show the next time you run the clean-up command.



Surry wrote:

pacman -Scc

Neither this nor removing all contents of the cache directory is a very good idea, it might come back and bite you you know where. As Androidz already stated there's no possibility to downgrage if you do it, which basically means that you won't be able to go back to current version of any package if anything gets broken on an update.


Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.

Offline

#22 2012-04-17 05:58:37

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there a way to "clean up" my package system?

meph wrote:
cupantae wrote:

However, if you do things the careful way of explicitly installing everything you need to use, that command is A-OK.

Good explanation, though there's another way around it. When you run one of the above mentioned commands to clean up your system and find something big amongst the packages to be removed (such as xorg-server), then it's easy enough to do:

pacman -S --asexplicit xorg-server

which will reinstall the package and mark it as explicitly installed. It won't show the next time you run the clean-up command..

https://bbs.archlinux.org/viewtopic.php … 5#p1088455

Offline

#23 2012-04-17 08:54:45

Padfoot
Member
Registered: 2010-09-03
Posts: 381

Re: Is there a way to "clean up" my package system?

Why the need to use pacman -R? Whenever I use pacman -Qdt it offers to remove the packages for me using pacman -Rs (or am I thinking of yaourt here?). No need to call it recursively.

Also, do not use pacman -Scc unless you absolutely need the disk space taken up by the packages in the cache. My update regime is as follows:

pacman -Sc
pacman -Syyu
pacman -Qdt

This way, right before I upgrade, my cache is cleaned up to only the currently installed packages, so I can downgrade if need be.

Cheers.

Offline

#24 2012-04-17 09:01:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there a way to "clean up" my package system?

Padfoot wrote:

Why the need to use pacman -R? Whenever I use pacman -Qdt it offers to remove the packages for me using pacman -Rs (or am I thinking of yaourt here?).

I think it's yaourt or something else.

[karol@black ~]$ pacman -Qdt
git 1.7.10-1
mercurial 2.1.2-1

pacman prints the info and does nothing more.

Padfoot wrote:

No need to call it recursively.

Then you may have more unused packages left (the dependencies of the packages you removed) and you need to run 'pacman -Qdt' again etc.

Offline

#25 2012-04-17 19:07:13

meph
Member
Registered: 2011-06-06
Posts: 160

Re: Is there a way to "clean up" my package system?

karol wrote:

I think it's yaourt or something else.

Indeed it is yaourt:

(orphans listed here)
==> Do you want to remove these packages (with -Rcs options) ?  [y/N]
==> -----------------------------------------------------------------
==> 

Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.

Offline

Board footer

Powered by FluxBB