apt, the default command line package manager for Debian and Ubuntu based Linux Distributions, released new version 3.1.0 on Monday.
As you may know, apt 3.0 introduced new package dependency resolver with more efficient and clean output. Now, the resolver 3 is enabled by default in the new 3.1 release.
As you see in the screenshot above, it’s enabled for both apt
and apt-get
by the rules in the 01-vendor-ubuntu
configuration file for Ubuntu, though Ubuntu 25.10 has already enabled this feature for current default apt 3.0.
why and why-not sub-commands
Similar to aptitude
, apt
now has new why
and why-not
sub-commands, allowing to find out why a certain package was installed, or why a package is not installable. And, here’s the description about them in the man page:
These commands print the reasoning path from the solver. They are similar to the equivalent aptitude commands for many use cases, but are different in that they print the actual reason the solver picked rather than the potential strongest path.
The why command determines why an installed package is installed. This provides reasonable feedback as to why an automatically installed package is installed; for a manually installed package no other reason is given. If the package is not installed, no reason can be determined.
The why-not command determines why a package was determined to not be installable. This may not always yield a result, even if a package is uninstallable.
Both commands take a single argument, the name of a package.
For example, run the command below to determine why libheif1
package was installed in system:
apt why libheif1
In my case, it told me user selected to install libm17n-0
. The package depends libgd3
, and libgd3
depends libheif1
, so it was installed along-with as dependency.
Include and Exclude options
Besides that, apt 3.1 introduced new Include
and Exclude
options, allowing to set allow-list or remove packages from a repository.
This is useful when a repository (e.g., Ubuntu PPA) contains many app packages, but you need only one or some of them, and want to block all others. Previously, we can add a rule under /etc/apt/preferences.d
to set package priority. Now, the new method is way stronger, as it excludes the packages from being parsed into the cache.
For example, assume that you added ppa:ubuntuhandbook1/apps PPA, but only need the converseen
package, then you may edit the corresponding .sources file under /etc/apt/sources.list.d
directory, then add:
Include: converseen
After that, save file and run sudo apt update
to refresh cache. Finally, only converseen
package from that PPA is available to install, while all others are excluded.
NOTE: “include” and “exclude” do not handle dependencies. You need to add them all if they are also available in the repository. For example, include audacious
and all its dependencies via:
Include: audacious libaudcore5 libaudgui5 libaudqt2 libaudtag3 audacious-plugins audacious-plugins-data
For choice, Softare & Updates utility offers a graphical way to include/exclude packages.
Just launch the tool and navigate to “Other Software” tab, then highlight and edit the source repository, finally click Add button under “Additional Fields”, set Key to either Include
or Exclude
and input package names as value.
How to Get apt 3.1.0
apt 3.1.0 has been made into Debian experimental repository. It will be backported to latest Ubuntu development release once migrated to Debian Unstable (Sid) repository.
If you can’t wait for the update, then you may grab the source code and build it by yourself.