You are not logged in.
Through pacman alone, how do I remove a package AND its all of its required/optional dependencies that are NOT required/optionally required by any other package.
I ask this because pacman keeps wanting to remove dependencies of the package that are also optionally required by other packages. I also want to remove every other file created by the package on my system as part of its installation process (e.g config files, docs etc)
If all of this is not possible through just pacman, is there any other way?
Last edited by to_you_bannana (2024-08-16 17:20:19)
Offline
pacman -Rsst-s, --recursive
Remove each target specified including all of their dependencies, provided that (A) they are not required
by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and
analogous to a backwards --sync operation, and it helps keep a clean system without orphans. If you want to
omit condition (B), pass this option twice.
Gets you most of the way there. It will remove packages that were explicitly installed even if they are optional for other packages. A single -s will not remove explicitly installed packages.
To do exactly what you ask, there is no direct way to do that with vanilla pacman. I think a script could do it.
You might also be interested in pacman -Qdt which displays orphaned packages that are not explicitly installed. use
pacman -Qdtto see if there are any orphans. you can remove them with
sudo pacman -Rs $(pacman -Qdtq). Rarely, that will create more orphans, so repeat that command until there are none.
Last edited by ewaller (2024-08-16 18:25:41)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
"-t" dosen't appear to be a valid option. If I run pacman -Rss on its own, it still wants to remove the dependencies of the package that are optionally required by other packages
Offline
"Appear" how?
https://man.archlinux.org/man/core/pacm … PLY_TO_-Q)
To do exactly what you ask, there is no direct way to do that with vanilla pacman.
But pacman will point out optional dependencies and list the gonna-be deleted packages.
I guess you're looking for a feature to explicitly hold/exempt packages (as the specific behavior asked for is rather specific and probably better suited for pacutils)
=> https://gitlab.archlinux.org/pacman/pacman/-/issues/
Offline
These are some very confusing answers. I've reread the question several times thinking it's more likely I misread it than ewaller and seth both misreaded it. In any case, as I read it, all you want is `pacman -Rsn <package>`.
That will not remove user config files (e.g., under $HOME), but it will meet all other stated goals.
EDIT: oh, yes this will also remove dependencies that are only optional for other packages - but those should be marked as explicitly installed, otherwise how did they get on your system?
Last edited by Trilby (2024-08-17 01:08:22)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
"Appear" how?
user% pacman -Rsst tauon-music-box
error: invalid option '-t'oh, yes this will also remove dependencies that are only optional for other packages
Ill clarify the question with a real life example, for example, I ran the following command, and it outputted the following:
user% sudo pacman -Rsn tauon-music-box
checking dependencies...
:: avahi optionally requires python-dbus: avahi-bookmarks, avahi-discover
:: noto-fonts optionally requires noto-fonts-extra: additional variants (condensed, semi-bold, extra-light)
:: python-lxml optionally requires python-beautifulsoup4: support for beautifulsoup parser to parse not well formed HTML
:: python-pyqt5 optionally requires python-dbus: for python-dbus mainloop support
:: rustdesk optionally requires libappindicator-gtk3: tray icon
Packages (23) libappindicator-gtk3-12.10.0.r298-4 marisa-0.2.6-13 noto-fonts-extra-1:24.8.1-1 opencc-1.1.8-1 opusfile-0.12-4 python-anyio-4.4.0-1 python-beautifulsoup4-4.12.3-2 python-dbus-1.3.2-4
python-h11-0.14.0-3 python-httpcore-1.0.5-1 python-httpx-0.27.0-1 python-isounidecode-0.3-3 python-musicbrainzngs-0.7.1-7 python-natsort-8.4.0-2 python-pylast-5.3.0-1 python-pysdl2-0.9.16-1
python-send2trash-1.8.2-2 python-setproctitle-1.3.3-2 python-sniffio-1.3.1-3 python-soupsieve-2.6-1 python-websocket-client-1.8.0-1 sdl2_image-2.8.2-4 tauon-music-box-7.8.0-1How do I go about removing the tauon-music-box package and its dependencies, without removing its dependencies that are optionally required by other packages? E.g python-dbus for avahi, libappindicator-gtk3 for rustdesk etc.
- but those should be marked as explicitly installed, otherwise how did they get on your system?
I assume those are required dependencies by, in this case, tauon-music-box. Coincidentally they are also optional dependencies of some other packages. I don't want to mark them as explicit because I want them to also get uninstalled if I uninstall every package that may require them or optionally depend on them.
Last edited by to_you_bannana (2024-08-17 06:04:20)
Offline
How do I go about removing the tauon-music-box package and its dependencies, without removing its dependencies that are optionally required by other packages?
"Manually" - you copy the list of packages and withdraw the ones you want to keep (for actually whatever reason)
That's why I think a flag like "--keep" might actually make sense as it allows you to read the output, decide "ok, foo can go - I don't need the optional feature in snafu, but I'd like to keep bar in baz" and re-issue the removal but add "--keep bar"
Offline