You are not logged in.

#1 2017-06-25 06:37:22

vincentm
Member
From: France
Registered: 2016-05-06
Posts: 10

Is it relevant to use pacman -Qdt ?

Hi all,

For several days I've been thinking of 'cleaning' my list of installed packages, assuming some of them were no longer needed. I found the 'pacman -Qdt' command in the wiki, but I'm not sure if it really only lists packages which are definitely not needed by others.

Have some of you ever used this command and deleted all the listed packages ? How did it go ?

Thanks in advance.

Offline

#2 2017-06-25 06:44:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Is it relevant to use pacman -Qdt ?

man pacman

Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-06-25 11:12:38

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Re: Is it relevant to use pacman -Qdt ?

I regularly run

 pacman -Rns $(pacman -Qdtq)

Typically this just removes a handful of random makedepends from building AUR packages and more rarely a package which legitimately is no longer a dependency of some updated package. It's never caused a problem for me, and it shouldn't on a properly maintained installation. It will not remove a dependency of another package, not even optional depends.

If you are still concerned (maybe -Qdt shows you very large # of packages?) then you'll need to look through the list and decide which packages you want to keep by first marking them as explicitly installed using "pacman -D --asexplicit". Afterwards, "-Qdt" won't list them anymore. I'd expect this to be unnecessary, however.


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

#4 2017-06-25 11:28:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,545
Website

Re: Is it relevant to use pacman -Qdt ?

Odysseus wrote:

it shouldn't [cause a problem] on a properly maintained installation.

I fully agree.  However, it might be useful to define what a "properly maintained installation" is as it seems the OP may be doing something that would not meet that definition.  One may not be doing anything necessarily wrong to find themselves with -Qdt listing things they want - but if one does adhere to some best practices -Qdt will more reliably list things that can be removed.

The easiest way to end up with -Qdt listing packages you actually want is through installation of package groups* and removal of the apex packages of that group with `pacman -R`.

For example, imagine you installed a full DE and eventually decided you did not want the full DE (but perhaps you wanted some parts) and you removed a few of the unwanted packages with `pacman -R <pkg>`.  Then sometime later you ran `pacman -Qdt` - that might very well list packages that you actually want.  The problem is, if you actually want them, they should be explicitly installed in the first place.

These circumstances would be avoided by removing packages with `pacman -Rs <pkg>` rather than just `pacman -R <pkg>`.  In the above scenario, if you tried to remove some of the uneeded packages with -Rs you'd see that pacman was also going to remove stuff you wanted - so you'd then either reinstall those packages right away, or you'd use `pacman -D` to change the install reason for those packages before you removed the unwanted ones.

If you always use `-Rs` for the removal of packages (I use -Rsn) then anything listed by -Qdt should be much more reliable in only listing packages that you can safely remove.


* Actual package groups may not speficially lead to this situation, but rather any packages with extensive dependency trees will.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB