7

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 :)

2
  • since arch is not a source distro you won't find an equivalent of revdep-rebuild I rarely find broken ones... but it happens... and then I just rebuild and reinstall with the pkgbuild and let arch devs know if that worked. happened to smplayer a few months back. Commented Feb 7, 2011 at 11:16
  • @xenoterracide Thanks for the info, but in this question I couldn't care less about revdep-rebuild :)
    – phunehehe
    Commented Feb 7, 2011 at 12:16

4 Answers 4

4

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).

2
  • The point about pacman -Qe is interesting, I'm not familiar with the "group" thing. Regarding the side note, arent --asdeps and --asexplicit supposed to do just that?
    – phunehehe
    Commented Feb 7, 2011 at 12:12
  • @phunehehe No, pacman -Qe is a query (showing all explicitly installed packages) --asdeps and --asexplicit are sync options. --asdeps will INSTALL an application as a if it were a dependency. Since it is not actually required by anything, it will appear in a "pacman -Qdt" which lists all packages installed as dependencies that are no longer required by anything (usually those packages can be removed without consequence). The most confusing thing I found about pacman when I started (coming from ubuntu's apt-get/apt-cache) was that 1 utility was used for everything (behaviour changes with -S/-Q) Commented Feb 11, 2011 at 0:13
2

Thanks to DarwinSurvivor's answer I have been able to better understand how package management works in Arch. Now I can apply the same strategy that I use with Gentoo (with small modifications). The "equivalents" of the commands in the question are, respectively:

  1. pacman -S <package>
  2. pacman -D --asdeps <package>
  3. pacman -Rs $(pacman -Qqtd)
  4. Not available / not needed

The closest thing to /var/lib/portage/world in Gentoo is the result of the command pacman -Qe. Differences:

  1. Arch has package groups, which is basically several packages "grouped" together under a name. When a group is installed everything in the group is considered explicitly installed.
  2. Arch doesn't have "system packages", so reducing items from the result of pacman -Qe can actually result in important packages being removed.
1

If I recall correctly,

pacman -S package

installs a package

pacman -Rs package

removes a package and all its dependencies---but only those that wouldn't break other packages and only those that you didn't explicitly install.

Checkout the pacman man page.

I unfortunatly don't know how to check for broken packages.

0

Instead of relying on the package manager to keep track of the explicitly installed packages, you could use a configuration management tool like Ansible on your system. I use that for my own few machine and I always can set up a machine just like my main machine with just two commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .