You are not logged in.
Hey there !
I am new to Linux but Arch is running fine for a few month now on my machine and I am quite happy ![]()
I read the pacman Wiki regarding installing optional dependencies, but I still dont get it.
Assume I want to install the package yazi and with it some package for previewing , let´s say imagemagick. Now I could install yazi as is and then in a second command imagemagick with the the command
pacman -S --asdeps imagemagick
At least that is what I think the Wiki suggests.
Now, why does it make sense to specify/mark a package as dependeny without having a chance to tell the dependency to WHAT? ![]()
Say, in 1 year I want to completely uninstall yazi and with it the packages I installed as dependency - how can pacman know?
I know that there is the concept of "orphaned" packages, but in my opinion that is something completely different. In my logic, IF i tell a package manager to uninstall a package and with it the dependecies (that might not even be "official" optional dependencies, but just packages I wanted to use with that specific package) I want that dependency to be gone after uninstallation of teh explicitely installed package even if some other package in the meantime also made use of it? (This way I would at least recognize during uninstall that a previously "optional" dependency became a needed dependency in the meantime?)
Is there any way to "link" optional packages to the one package installed so it is removed together with the "explicit" package?
Thanks!
Last edited by hedgehog86 (2026-08-02 15:10:36)
Offline
Say, in 1 year I want to completely uninstall yazi and with it the packages I installed as dependency - how can pacman know?
"pacman -Qm"
"orphaned" packages, but in my opinion that is something completely different
'key…
I want that dependency to be gone after uninstallation of teh explicitely installed package
"pacman -Rs"
even if some other package in the meantime also made use of it?
That is not going to happen - if some other package depends on IM you cannot remove it (w/o -Rdd forcing that)
Is there any way to "link" optional packages to the one package installed so it is removed together with the "explicit" package?
You can create a local meta-package that just hard-depends on yazi and IM, but removing that will not remove IM if it still serves as dependency for something else
If you "pacman -S yazi" and opt out of IM and then later "pacman -S --asdeps imagemagick" and then ultimately "pacman -Rs yazi" that will remove IM unless there're other consumers in which case it will be removed when you -Rs the last of those.
Other approaches don't make much sense.
Offline
Thanks for the kind reply!
Other approaches don't make much sense.
Well, yes - I guess it would not make sense to force-remove a package that another package in the meantime relies on but as I see that the number of packages I have on the system is increasing rapidly, so sometimes it would be nice to have some kind of "history" or call it user docu about which package was INITIALLY installed by whom and because of which reason ![]()
Thanks!
Last edited by hedgehog86 (2026-08-02 15:55:38)
Offline
/var/log/pacman.log ?
Offline
This is quite a reasonable question on it's surface - but it's completely a moot point if you periodically do some basic system maintenance.
Specifically, pacman can quite easily list all the packages installed as dependencies that are 1) not depended on by any other package, or 2) neither depended on nor optionally depended on by any package. If there is ever anything in the second list, it should be removed, no questions asked. Anything on the first list, you should ask the question: do I want this. To inform the answer to that question, pacman can tell you which packages you have installed optionally depend on said package.
So building on your example, if you install IM as an optional dependency (and you do to use with yazi) then after you properly remove yazi, IM will either be 1) removed too or 2) it will be on list #1 above. You can then check with pacman what else optionally uses IM and decide if you want to keep it or not.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline