Listing all installed packages together with the module they are from (if any) and their repo ID

Latest response

This works

rpm -qa --queryformat='%{name} %{evr} %{modularitylabel}\n'

But there's no repoid or ui_from_repo field.

This works:

dnf repoquery -a --queryformat='%{name} %{evr} %{repoid} %{ui_from_repo}'

... but it includes non-installed packages. If I replace -a with --installed then the value of the repoid and ui_from_repo fields changes to @System!

Additionally if I try to add modularitylabel to the dnf repoquery command, the command fails with no such field.

I know about dnf list which includes ui_from_repo by default, but the output isn't machine-readable, and it doesn't include modularitylabel.

Is there any way to get the list of installed packages, plus the module (if any) and repo that they were installed from?

Responses

There's a from_repo tag that works in combination with the --installed option.

dnf repoquery --installed --queryformat='%{name} %{evr} %{from_repo}' | column -t

I've yet to find a way to get dnf to output modularitylabel or something like it.

Looks like this is unfixable:

https://bugzilla.redhat.com/show_bug.cgi?id=2072943

I hate modules! :(