by danielscrubs · 6y ago · 0 comments
"How do I remove a package and all of its dependencies? [...] The package manager does not do recursive dependency removal on removal of a package. This error-prone automation will not be added to the package manager. "
while kiss orphans | grep -qv $HOSTNAME; do
kiss remove `kiss orphans | grep -v $HOSTNAME | tr '\n' ' '`
done
This was much easier to implement in kiss than other package manager extensions in previous distros I've maintained packges for (gentoo, exherbo, arch, debian). sudo pacman -Rns $(pacman -Qqdtt)
Done.Habitat (hab), nix, and others IIRC do SxS package mgmt.
Everything Should Be Made as Simple as Possible, But Not Simpler - possibly paraphrasing Einstein
Another elegant way, for a more civilized time, is to simply disallow dependencies. If none of your packages has any dependencies, then no dependency hell is ever possible. This is possible and easy with static executables (for binary packages), and by embedding the interpreter of packages written in scripting languages.
On every distro uninstalling packages never really reverts the system to its previous state, always leaves some junk behind.
That's not true at all. See Nix package manager (and NixOS the distro).
$ realpath /etc/fstab
/nix/store/06k708q78zxw8922rrrc8mmp5gbin4am-etc-fstab
However, NixOS installations can also end up accumulating configuration and state files that stick around when they are not defined declaratively. E.g. if you enable ssh, host keys are generated in /etc/ssh. Even if you disable ssh, these files will stick around.You can avoid such accidental state [1], since NixOS will happily boot from a filesystem with just /boot and /nix and reconstruct the rest upon system activation. But it is quite a bit of work, since you need to manually specify what state you want to preserve (e.g. SSH host key files). Also, it currently does not work nicely with some systemd units that barf out if you make /var/run entries symlinks.
Not at all. Apt has been able to remove everything for the last 20 years.
Not really. It can remove configuration files etc. it knows about, but it can't know about files later created by the application itself.
That's also not what's being asked for here. The basic request is this: track which packages were manually vs automatically installed, and give the user the ability to remove automatically-installed orphans whose manually-installed reverse-dependencies are no longer installed. This is what APT does and it works fine 99% of the time.
This list may include Firefox and other "end" software so a brain is required when parsing the list. You'll come to learn the relationships between packages and their dependencies and this will eventually become effortless.
EDIT: I'm wrong, see below.
> To remove a package and its dependencies which are not required by any other installed package:
> # pacman -Rs package_name
> To remove a package, its dependencies and all the packages that depend on the target package:
> # pacman -Rsc package_name
This is explicit rather than implicit but it works even on one package.