Is there an interactive way to install dnf packages?

For some package managers (flatpak, yay, …) there exists an interactive search if you don’t know the exact name of a package. With flatpak you use it like:

flatpak install test

Similar refs for 'test' found:
    1) mytest
    2) yourtest
    3) ourtest
Which do you want to use (0 to abort)? [0-3]: _

If I use dnf this is not possible. So my workflow looks like:

sudo dnf install test  # maybe I am right? :)
    No match for argument: test

dnf search test  
    mytest: Some test
    yourtest: Some test
    ourtest: Some test

sudo dnf install ourtest  # install correct package

This feels clunky.

Is there a way to do it interactively as in the first example?

With those package managers that give suggestions, how do you know which one is correct? Package names are not necessarily the same as the program or upstream project name.

Even if the package name is what you think it should be, it might be the wrong version or wrong part of the software (e.g. a CLI instead of GUI, or a metapackage that includes extra things you don’t want).

Instead of guessing with install first, you should use search and info first.

dnf search test
dnf info ourtest # wrong
dnf info mytest # correct
sudo dnf in mytest # actually know you're installing the correct package

Measure twice, cut once. Saves you time in the long run.

1 Like

Thank you. I guess as always the “correct” way is the (at least for my usecase) inconvenient one :smiley:

An additional issue is that most interactions with dnf are supposed to be non-interactive and / or “unattended”. It might be possible to make an opt-in feature like this (with an additional --interactive argument, for example), but imagine, for example, servers which run dnf commands to auto-update, or test farms which use “dnf install” to prepare environments, suddenly failing because dnf started requiring interactive user input.

dnf list is also ver handy.

I searched for the tor browser but just new the tor package so I checked with

sudo dnf list *tor* this gave me to much options so i just removed the asterisk before tor,
sudo dnf list tor*
Then to be sure if it is what I wanted I checked with dnf info the torbrowser-launcher packages to see what it contains and for what exactly it is.


Not quite true IMHO. For example with dnf the install, reinstall, remove & upgrade commands require that one acknowledge and approve the action before dnf actually does the change. This can be automatically approved by using the -y option, but it still seems actually designed for user interaction from the cli with that option as a shortcut way to run it from scripts or unattended.

Is there any chance I could write an pull request for something like that?

I am a computer science student and also somewhat into C, but have never contributed to something like this. To they even consider may changes? Can I comprehend the source code of dnf without help?

Well, true, those environments usually use the --assumeyes / -y flag. However, even that won’t help you with questions that are not yes/no like “here’s a choice of three packages, which one do you want”. :slight_smile:

The package manager (dnf, written in Python/C) is currently undergoing a complete rewrite as DNF5 (written in C++) - while they’re still busy making sure there’s no missing crucial features, something like an --interactive flag might be something they’re interested in. I would say open a ticket with the project, and if they’re interested, you can try implementing it:

1 Like

Okay, I wil do that! Thank you!

Here is the ticket: [Feature request] DNF interactive install mode · Issue #666 · rpm-software-management/dnf5 · GitHub

Dnf is interactive. I have no idea why you think it is not.
Dnf has query abilities to help you find packages and inspect them.

Do you mean it is an a GUI?

We might have different interpretations of “interactive” here …

You tell DNF what to do, but DNF cannot ask you what you want / what you mean. It prints output and then you need to run it again, and it doesn’t even really remember the previous “encounter”.

1 Like

We clearly have differing definitions of interactive. Dnf has been clearly interactive for quite some time. Intelligent, no, but interactive, yes!

It seems the OP was asking for “fuzzy search” features and not just strict search as dnf has been to date. That should be relatively simple to implement since many apps and web browser search engines have that feature today.

It is already nearly there since one can use globs

1 Like

That is not what dnf is designed to do.
Indeed that is not how most cli tools work.
ls does not ask you why you use it either.

dnf search looks in the decription of packages as well as there namex for matches.
That usually allows me to find packages I am not familial with.