Issue
What were you trying to do that didn't work?
Automatically remove all packages that are neither user-installed nor transitively Required by any user-installed package (i.e. what dnf autoremove is supposed to do).
Please provide the package NVR for which bug is seen:
dnf-4.7.0-19.el8 in particular, but the same appears to be true for RHEL 9 (and in dnf master from looking at the code).
How reproducible:
Always, since this is a missing feature rather than a strict bug.
Steps to reproduce
Configure 'install_weak_deps=False'
Install package A which 'Requires: C', pulling in C as a dependency.
Install package B which 'Recommends: C'
Remove package A
Run a dnf autoremove
Expected results
There should be some way to configure dnf autoremove to ignore weak dependencies, resulting in C being automatically removed.
Actual results
There is no such ability; the weak requirement of B on C will prevent it from ever being autoremoved.
This means that the 'install_weak_deps=False' config option is insufficient to prevent weak dependencies from sneaking into the system. It really feels like there should be a mirror option like 'retain_weak_deps=False' or 'autoremove_weak_deps=True' to allow cleaning up (or install_weak_deps should directly apply to autoremove, but that's a change in behaviour).
Workarounds like iterating over all packages in the system to manually identify such cases are not scalable.