3

I'm trying to get my head round the "suggests" and "recommends" relationships between Debian packages. I know that they give the users more choice about what to install and what not to.

But I'm only aware of manual and auto markers to indicate the reason for a package being installed. This doesn't contain enough information to track user decisions on whether or not to install suggested and recommended packages. I can't see in the documentation what behaviour apt takes for (package X recommends Y and suggests Z):

apt-get dist-upgrade upgrading X to a newer version which no-longer recommends Y or suggests Z.

apt-get dist-upgrade upgrading X to a newer version which recommends and suggests new packages (not already installed).

apt-get autoremove removing package X.


4

“Recommends“ and “Suggests” relationships mostly have an effect on package installations, and sometimes removals, not on upgrades.

At installation time, depending on its configuration (APT::Install-Recommends and APT::Install-Suggests), apt will automatically install any packages which are recommended and/or suggested along with the package carrying the recommendation or suggestion. The default settings enable this for recommendations, not suggestions. Packages installed in this way are marked as automatically installed.

At removal time, removing a package will cause apt to remove packages depending on the removed package, but it won’t process recommendations or suggestions. apt autoremove will then look for any package which is marked as automatically installed, and which no longer has any depending package (including recommendations and/or suggestions, depending on the Apt::AutoRemove::RecommendsImportant and Apt::AutoRemove::SuggestsImportant settings); any such package will be removed. The default settings keep recommended and suggested packages (which is asymmetric compared to the installation defaults, but avoids surprises).

At upgrade time, only installed packages are considered. apt upgrade tries to upgrade all installed packages to their candidate versions, without removing any package. apt full-upgrade (or dist-upgrade) considers removing packages if it allows other packages to be upgraded, but it won’t remove a package just because it stops being recommended as a result of the upgrade. Packages which are newly recommended or suggested by an upgraded package aren’t installed automatically. Packages which are no longer recommended or suggested become candidates for the next autoremove.

aptitude behaves slightly differently; it will perform the equivalent of apt autoremove when removing packages, and it will tell you about newly-recommended packages (but it won’t select them for installation automatically).

The following questions provide complementary information:

  • Okay I think that's clear. If I understand correctly then a user who never want "suggested" packages can end up with unwanted packages if: They install A [recommends C] then install B [suggests C] and finally remove A. Apt won't know that C was never wanted as a suggestion? – Philip Couling Jun 5 '18 at 11:04
  • Right, that is possible, especially since autoremoval is more conservative than you might expect (it keeps suggestions). You can however determine which packages are only present as suggestions; see the questions linked in my updated answer. – Stephen Kitt Jun 5 '18 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.