why not sudo pacman -Rns $(pacman -Qdtq)
? sorry if this has already been explained, I haven’t had time to read the whole thread yet.
Because it removes optional dependencies of other packages.
sudo pacman -R $(aura -O)
That does not work for me.
bash: aura: Kommando nicht gefunden.
(command not found)
To be clear, I use aura
for that because it is easier for me to remember aura -O
than pacman -Qdtq
. I don’t think there is a functional difference.
There is no real reason to install aura
just for that purpose.
I’ve been silently reading the thread and even though I don’t doubt the community’s findings, this caught me by surprise…
- The Arch Wiki:
Note: The arguments
-Qt
list only true orphans. To include packages which are optionally required by another package, pass the-t
flag twice (i.e.,-Qtt
).
man pacman
:
-t, --unrequired
Restrict or filter output to print only packages neither required nor optionally required by
any currently installed package. Specify this option twice to include packages which are
** optionally, but not directly, required by another package.**
Does that mean that both the Arch Wiki and the man pages need updating, or what…?
What is your proposed update?
The wiki and the man page do not disagree, if that is what you mean. Both of those descriptions say the same thing, they are just worded differently.
-Qt
does list only orphans. The issue of removing optional dependencies doesn’t come from that step.
It comes from using -Rs
to remove the packages you find with -Qt
. -Rs
will remove optional dependencies.
Yeah, good catch!
So then your solution of running pacman -R $(pacman -Qqdt)
until it fails does indeed sound like the best approach.
Edit:
Would something like this work? (I have no orphaned packages to test currently)
alias orphansrm='sudo pacman -R $(pacman -Qqdt) && while [ $? -ne 1 ]; do !!; done'
Personally, I would loop until pacman -Qqdt
returns nothing. If you are doing it programmatically, you don’t even need that last pacman call which returns an error.
That’s a good point… I was trying to code-golf it (which I shouldn’t).
Thanks to both of you, I removed my alias :
orph='yay -R $(yay -Qdtq)'
I’m thinking of a function like this :
orph() {
while [[ $(yay -Qdtq) ]]
do yay -R $(yay -Qdtq)
done
}
You might as well use pacman
instead of yay
. When it comes to removing packages, the AUR helper doesn’t add anything.
thanks for starting this thread. as a newbie I find great value in this type of thing. The first half of my Linux life (circa 2017) I was a poor housekeeper and paid the price for it. Fubar and chroot
were a way of life. Windows habits probably.
long story short I finally disabled the Endeavour startup box that comes up on boot. I never really used it except the first couple days.
what’s the command that does that, exactly?
(sorry if this is a hijack, it seems directly related)
sudo paccache -r
You can read more about that here: https://wiki.archlinux.org/title/Pacman#Cleaning_the_package_cache
The other settings are for configuring the paccache.timer
, which is a way of automating the process of deleting unused packages.
If you are interested, here is a discussion from last year related to using these utilities, and cleaning up systemd logs as well:
what would be the – arguments (or modified command) had I checkmarked the ‘remove uninstalled but still cached packages now’ field?
and thanks for the great response
The command would be sudo paccache -ruk0
. See the same ArchWiki article linked above:
Add the
-u
/--uninstalled
switch to limit the action of paccache to uninstalled packages. For example to remove all cached versions of uninstalled packages, use the following:# paccache -ruk0
See
paccache -h
for more options.
I like your idea of an orph alias coupled with dalto’s
alias orph=‘sudo pacman -R $(pacman -Qdtq)’
This graphical interface serve to set a systemd timer and the paccache service it triggers.
systemctl status paccache.timer
systemctl status paccache.service
As mentioned above I now use a function :
orph() {
while [[ $(pacman -Qdtq) ]]
do sudo pacman -R $(pacman -Qdtq)
done
}