Linux – Package management strategy with Pacman

arch linuxpackage-managementpacman

Since I switched my favorite distro to Gentoo I have been very familiar with the following pattern for installing and removing packages:

  1. Install a bunch of applications that do pretty much the same thing to try them out: emerge <package>. This command installs the package, and mark the package as explicitly installed.
  2. Do try them out and remove those I don't like (and hopefully keep one or two that satisfy my needs): emerge --deselect <package>. This command removes the package from the list of explicitly installed applications, but does not uninstall the package.
  3. Finally remove everything that is not required on my system: emerge --depclean. This command removes all packages that are (1) not a system package, (2) not installed explicitly and (3) not a dependency of those two.
  4. And optionally check that all package dependencies are OK: revdep-rebuild. This command checks all dependencies and reinstall broken packages.

Once in a while I would look at the entries in /var/lib/portage/world (the list of explicitly installed packages) to review the top-level applications that I use, and remove those that I don't use anymore using the commands in step 2, 3 and 4.

Now that I'm trying to learn Arch, I wonder if I could use the same strategy with Pacman? Or another strategy that can keep my system clean of unused packages?

Note: the Pacman Rosetta helps a lot in quickly understand things, but I could not figure out Arch's equivalent of the /var/lib/portage/world file. pacman -Qe is said to do it, but it contains things that I swear I haven't explicitly installed… Anyway please answer this question in terms of strategy (with command examples, of course 🙂

Best Answer

The most likely reason you are seeing packages with pacman -Qe that you don't remember installing is that they were part of a "group" (like base-devel, etc) that you installed.

Side Note: I have personally also been looking for a while to switch a package from "explicit" to "implicit" (and even vice-versa) without reinstalling it, it even taking a package I installed explicitly to get another package working and turn it into a dependency of that package (again without reinstalling).

Related Question