The new APT 3.0 solver

A crucial but often entirely transparent feature of a modern package management system like Debian’s APT is its solver – basically the set of rules and instruction on how to handle dependencies when installing a package. APT is currently in the process of radically changing its solver, the first bits of which can be found in APT 2.9.3, referred to as solver3. Many of the changes and improvements get a little into the weeds and will mostly be transparent to users, but there is one feature the new solver will enable that many of you will be incredibly excited about.

One of the core new capabilities of solver3 is the implication graph.

As part of the solving phase, we also construct an implication graph, albeit a partial one: The first package installing another package is marked as the reason (A -> B), the same thing for conflicts (not A -> not B).

↫ Julian Andres Klode

Seems rather innocuous at first sight, but here’s what the implication graph will make possible:

The implication graph building allows us to implement an apt why command, that while not as nicely detailed as aptitude, at least tells you the exact reason why a package is installed. It will only show the strongest dependency chain at first of course, since that is what we record.

↫ Julian Andres Klode

If you’ve ever dealt with packaging issues – probably when running -testing or similar unstable distributions that use APT, a command that tells you exactly why a package is installed is an absolute godsend. Sure, aptitude exists, but aptitude takes you out of your current CLI workflow, whereas this will be much easier to quickly run.

There’s more features solver3 will enable, but this one is definitely one of my favourite low-level additions to APT in a long, long time.

4 Comments

  1. 2024-05-14 11:49 pm
    • 2024-05-15 2:30 pm
      • 2024-05-15 6:56 pm
  2. 2024-05-15 5:21 pm