Information
The RPM packaging specification allows for 3 levels of dependencies to be declared:
- hard dependencies ( Requires / Provides ) for packages which must be installed for a minimal installation of the application to function
- weak dependencies ( Recommends / Supplements ) for packages which provide additional features, but which are not required for a minimal installation to function
- hints ( Suggests / Enhances ) for packages which offer add-ons which might be useful.
Unless a system specifically requires the additional capabilities provides by the weak dependencies, it is recommended that the packages are not installed to reduce the potential attack surface.
Solution
Edit /etc/dnf/dnf.conf and set install_weak_deps=0 in the [main] section.
[main]
install_weak_deps=0
Example script:
#!/usr/bin/env bash
{
if grep -Pq '^install_weak_deps' /etc/dnf/dnf.conf; then
sed -i 's/^install_weak_deps\s*=\s*.*/install_weak_deps=0/' /etc/dnf/dnf.conf
else
printf '%s\n' "" "install_weak_deps=0" >> /etc/dnf/dnf.conf
fi
}