You are not logged in.
I've used the above command to clean orphaned packages for a long time, till today where I found an alternative command for it (in the Arch wiki, it has to do something with ~pacman -Rsu). Typed it and it deleted some unused packages (unused dependencies) but since then, if I try to type "sudo pacman -Rns $(pacman -Qttdq)", It asks to remove all packages (like it promotes to delete all packages installed explicitly, sorted by alphabet, a new package every time I run the command). and when I press "Ctrl-C" to kill the command it opens all apps, one by one, also sorted by alphabet. For example, it opens Ark, then Bleachbit when the former is closed, then ......
Any possible solution ?
Last edited by 1.7xr (2022-07-16 23:59:30)
Offline
Check the output of the command "pacman -Qttdq". There may be a package name in there that is interpreted as a separate command. To avoid this sort of expansion, it is recommended to pipe the output to pacman:
pacman -Qqdt | pacman -Rsn -Note the "-" which tells pacman to read the names from stdin. I also omitted the extra "-t" because systematically removing optdeps is generally not desirable.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
pacman -Qttdqshows a list of all installed packages and
pacman -Qqdt | pacman -Rsn - promotes to delete them...
Is there a way to delete pacman database completely and rebuild it ? I've run
pacman -Syyucouple of times and it didn't help.
Offline
The sync database is fully refreshed after "pacman -Syyu". The local database cannot be recreated once deleted so you should not do that.
Pacman is supposed to prompt you before removing packages unless you pass the --noconfirm option. However, that command should not run other commands nor try to delete everything that you have installed.
So, are the packages listed by "pacman -Qttdq" not orphans? If so, did you accidentally change the installation reason of all of your packages?
It is also unclear how that command could possibly lead to other commands being run as you described in your first post.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
did you accidentally change the installation reason of all of your packages?
Yeah I think that's the reason, because when I type "pacman -Qe" it only lists 4 packages, and all others are listed as orphaned packages...
Any way to fix this ?
Edit: The command that caused the problem is :
pacman -Qtdq | pacman -Rns -Last edited by 1.7xr (2022-07-17 01:47:21)
Offline
Edit: The command that caused the problem is :
pacman -Qtdq | pacman -Rns -
There is no way that command could change the installation reason of your packages. The reason can only be changed with "pacman -S --asdeps" or "pacman -D --asdeps".
You can manually create a list of the explicitly installed packages, one per line, and then pass it to pacman -D to change the reason:
pacman -D --asexplicit - < pkgs.txtYou could start with the list of all installed packages and filter them
pacman -Qq > all_pkgs.txtedit: Added missing "-" to command above.
Last edited by Xyne (2022-07-18 01:01:39)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Thanks mate! I remember that the last time I've ran the clean command, there was nothing to clean. Therefore, any other packages are certainly explicitly installed.
Your command didn't work. So, I searched the forum and found this command:
sudo pacman -D --asexplicit $(awk '{print $1}' input_file.txt)and It fixed it!
Thanks for your time... The problem can be marked as Solved.
Offline
You can mark the thread yourself (edit your first post and add [SOLVED] to the title).
Offline
Sorry, my command was missing a "-". I've edited my previous post to fix it.
I'm glad that you've fixed it. You can edit the first post and prepend "[SOLVED]" to the subject.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline