Thanks for that hint
@CaffeineAddict .
An alternative to the option "autoremove --purge" is "autopurge".
The following is some ancillary observations which are based on an exploration which may appear long-winded, but tries to clarify some issues about dependencies.
The package that apt proposes to remove with the autoremove command, should have no packages that depend on it. If no packages depend on it, it's safe to remove since nothing else will be affected by its absence. That's the logic.
To determinine which packages depend on the package that is proposed for removal, one can use the option: rdepends, to the apt command.
The package slated for autoremoval may however depend on something else though. To see the packages that it depends upon, one uses the option: depends, to the apt command. Hopefully this will become clear in the following examples.
Here is a list of the packages proposed by the apt command for removal by use of the autoremove option a machine here.
Code:
[root@min ~]# apt -s upgrade
<snip>
The following packages were automatically installed and are no longer required:
libgphoto2-l10n libnsl-dev libpython3.12-minimal libpython3.12-stdlib libtirpc-dev linux-headers-6.6.13-amd64
linux-headers-6.6.13-common linux-image-6.6.13-amd64 linux-kbuild-6.6.13 python3.12 python3.12-minimal
Use 'apt autoremove' to remove them.
<snip>
Taking as an example the package: libgphoto2-l10n, to see what it depends on:
Code:
[ben@min ~]$ apt depends libgphoto2-l10n
libgphoto2-l10n
The output shows it depends only on itself.
When asking apt what depends on the package libgphoto2-l10n, the following appears:
Code:
[ben@min ~]$ apt rdepends libgphoto2-l10n
libgphoto2-l10n
Reverse Depends:
Recommends: libgphoto2-6 (= 2.5.31-2)
Recommends: libgphoto2-6t64 (= 2.5.31-2.1)
The output shows that nothing depends on it, except itself. Since that's the case, it appears to be safe to remove.
In relation to the "Recommends" output which suggests some packages that are recommended for installation with libgphoto2-l10n, as recommended packages, they aren't essential and therefore won't break anything and can be ignored here.
Presumably in this installation, another package did depend on libgphoto2-l10n at some point, but that other package has either been removed, or upgraded rendering this package redundant and thus removable.
Looking at another of the packages recommended for removal, gives a different picture:
Here is what python3.12 depends upon:
Code:
[ben@min ~]$ apt depends python3.12
python3.12
Depends: python3.12-minimal (= 3.12.3-1)
Depends: libpython3.12-stdlib (= 3.12.3-1)
|Depends: media-types
Depends: mime-support
Depends: tzdata
Breaks: python3-all (<< 3.6.5~rc1-1)
Breaks: python3-dev (<< 3.6.5~rc1-1)
Breaks: python3-venv (<< 3.6.5-2)
Recommends: ca-certificates
Suggests: python3.12-venv
Suggests: python3.12-doc
Suggests: binutils
The package python3.12 depends on a number of packages other than itself. as listed. The "Recommends" and "Suggests" can be ignored. The "Breaks" identify conflicts.
Here is a listing of what depends upon the python3.12 package:
Code:
[ben@min ~]$ apt rdepends python3.12
python3.12
Reverse Depends:
Depends: libpython3.12-testsuite (>= 3.12.3-1)
Recommends: python3.12-minimal
Depends: python3.12-venv (= 3.12.3-1)
Recommends: python3.12-minimal
Depends: python3.12-full (= 3.12.3-1)
Suggests: python3.12-doc
Depends: python3.12-dev (= 3.12.3-1)
Depends: python3.12-dbg (= 3.12.3-1)
Depends: python3-all
Enhances: idle-python3.12
Depends: idle-python3.12
The question arises, if so many packages depend on python3.12, why would it be slated for removal by autoremove?
The answer is that the output above is based on apt's database for the whole distro, and not just the installation in which the command is being run. When apt is asked about the current installation, it becomes clear why the package python3.12 can be removed. To restrict the output to the installation, the option --installed is used.
Here are the packages that python3.12 depends upon in this installation:
Code:
[ben@min ~]$ apt --installed depends python3.12
python3.12
Depends: python3.12-minimal (= 3.12.3-1)
Depends: libpython3.12-stdlib (= 3.12.3-1)
|Depends: media-types
Depends: mime-support
Depends: tzdata
Breaks: python3-dev (<< 3.6.5~rc1-1)
Recommends: ca-certificates
Suggests: binutils
Here are the packages that depend on python3.12:
Code:
[ben@min ~]$ apt --installed rdepends python3.12
python3.12
Reverse Depends:
Recommends: python3.12-minimal
Recommends: python3.12-minimal
It's clear now that nothing depends on python3.12, other than itself in this installation, hence it is safe to remove.
The upshot of this exploration is that it's not dependencies that will be removed by autoremove, neither, what the package depends upon, nor what depends upon that particular package, rather it's the determination of dependencies that apt does internally that controls which packages it will recommend for autoremoval. Rather than proposing packages be removed with dependencies ( as inferred in post #1), it's those packages which are no longer depended upon that are slated for removal.
The --purge or autopurge options to the apt command will indeed remove the configuration files of packages, but they are not dependent packages themselves, rather they are component files of the packages.