Debian – apt wants to autoremove automatically installed recommended packages despite settings in apt.conf.d

aptaptitudedebian

When I'm running apt upgrade, it suggests me to auto-remove several dozens of essential packages using apt autoremove.

They include busybox, bluetooth and alsa-utils among other important packages which were all marked as automatically installed & recommended packages in the aptitude interface.

aptitude, however, does not want these packages to be auto-removed when pressing g for preview. This inconsistency really puzzles me. aptitude's configuration to install recommended packages is set to default, which is true, therefore it works as expected.

This strange auto-remove inconsistency with apt started when I created a new file in /etc/apt/apt.conf.d/ prefixed with 99 to auto-remove all recommended packages using the following instructions:

APT::Install-Recommends "false";
APT::AutoRemove::RecommendsImportant "false";
APT::AutoRemove::SuggestsImportant "false";

And then I changed my mind, and decided to keep the recommended packages but not the suggested packages as a compromise.

APT::Install-Recommends "true";
APT::Install-Suggests "false";
APT::AutoRemove::RecommendsImportant "false";
APT::AutoRemove::SuggestsImportant "false";

It clearly instructs apt to install & keep recommended packages, but not the suggested packages.

Why does apt want these packages to be auto-removed if they're recommended when APT::Install-Recommends is set to true?

I'm using the testing version of Debian Buster.

Best Answer

It clearly instructs apt to install & keep recommended packages, but not the suggested packages.

No, it instructs apt to install recommended packages, but not to keep them. You need to specify

APT::AutoRemove::RecommendsImportant "true";

if you want apt to keep recommended packages.

Related Question