Hello,
How can I query dnf
to find out why a weak dependency was installed?
As a trivial example, libreoffice-gtk4
is installed as a weak dependency of libreoffice
, but if I didn’t know this, how would I find it out?
First, I can confirm that it is a weak dependency by querying the install reason:
$ dnf repoquery --installed --qf '%{reason}\n' libreoffice-gtk4
Weak Dependency
Now, I want to get dnf
to tell me that the presence of libreoffice-gtk4
is due to libreoffice
. In other words, I want to know this is a Weak Dependency of what?
Here is what I have tried:
Using repoquery
with --whatdepends
and every other flavour seen in man dnf-repoquery
(--whatenhances
, --whatrecommends
etc.). None of them return anything, with or without the presence of --installed
.
$ dnf repoquery --whatdepends libreoffice-gtk4
Updating and loading repositories:
Repositories loaded.
The same, but with the full NEVRA string, which also returns nothing
$ dnf repoquery --whatdepends libreoffice-gtk4-1:24.8.4.2-3.fc41.x86_64
Updating and loading repositories:
Repositories loaded.
We can show that dnf
indeed knows this is a dependency of libreoffice by:
Running autoremove
, which determines there is nothing to remove.
$ dnf autoremove
Nothing to do.
Checking what will happen if we try and uninstall libreoffice
:
$dnf remove libreoffice
Package Arch Version Reposit Size
Removing:
libreoffice x86_64 1:24.8.4.2-3.fc41 updates 0.0 B
Removing unused dependencies:
...
libreoffice-gtk4 x86_64 1:24.8.4.2-3.fc41 updates 1.8 MiB
...
So dnf
clearly knows that libreoffice-gtk4
is a weak dependency of libreoffice
, and clearly knows that it is only installed because libreoffice is also installed.
If I didn’t already know the parent of a weak dependency, how could I get dnf
to tell me?
I am using Fedora 41 with dnf5 version 5.2.8.1.
My version info
$ cat /etc/fedora-release
Fedora release 41 (Forty One)
$ dnf --version
dnf5 version 5.2.8.1
dnf5 plugin API version 2.0
libdnf5 version 5.2.8.1
libdnf5 plugin API version 2.0
Loaded dnf5 plugins:
name: builddep
version: 1.0.0
API version: 2.0
name: changelog
version: 1.0.0
API version: 2.0
name: config-manager
version: 0.1.0
API version: 2.0
name: copr
version: 0.1.0
API version: 2.0
name: needs_restarting
version: 1.0.0
API version: 2.0
name: repoclosure
version: 1.0.0
API version: 2.0
name: reposync
version: 1.0.0
API version: 2.0