Terminal takes a while to execute sudo dnf command

, ,

Hello I am new to fedora.
I am using fedora 31, KDE environment.
Only thing that bugs me in fedora is slow Terminal Emulator.
Terminal takes too long to process " sudo dnf " commands.
After entering the “sudo dnf” command it takes a while to start process whether it is update or install or search.
Is there any solution for this??

1 Like

   Hi @nrj.  Yes, dnf famous for being rather slow[1](https://discussion.fedoraproject.org/t/terminal-takes-a-while-to-execute-sudo-dnf-command/75335/4).  Avoid using the Tab-autocompletion feature with the dnf commands.


  1. 1 ↩︎

hi @vits95. I never use Tab-autocompletion feature for any command

2 Likes

@vits95: when you make statements like that, you really should provide some evidence/references.

dnf works fine here, I have seen it take some time to “initialise” from time to time, but never enough to make me debug it.

@nrj: lets start by collecting some information. Can you:

  • see what’s going in the process list when this occurs? Use htop, for example.
  • run dnf with verbosity increased: see man dnf on how to do this. Probably just -v but worth double-checking
1 Like

hi @FranciscoD ,
I am a noob in linux so can you please tell me steps to do so?!
i have installed htop. But as you asked to see what’s going on while running dnf, i dont know how to do that.
when i run htop command in my terminal it shows this.

also i dont know how to run dnf with increased verbosity.

This behavior of DNF happens since it replaced yum in earlier versions of Fedora. I also suffer from it, but I could check that if you include --refresh option (which may not be optimal, however), it goes a litlle bit faster:

$ sudo dnf --refresh update

Regards.

   If dnf ran from the Kernel console, the issue shows up too?

You see. As far as I know, --refresh should also force to download and update the metadata cached in the system, so it should instead slow down the whole operation.

2 Likes

Paradoxes of this life!, :smile: That’s why I said that it might not be optimal. Theoretically, it should be even slowlier but, at least in my computer, this commands responds immediately:

$ sudo dnf --refresh update

whereas this other one takes up more than 5 minutes to respond

$ sudo dnf check-update

Kind regards!

kernel console??
sorry but i dont know much about it.
I am using Terminal Konsole (KDE console).
I have also tried gnome console still the same result.

1 Like

I think there are two different things going on here. The OP is talking about a general lag when executing the command (like after hitting Enter nothing is moving for a seconds) - this happens to me as well, however, infrequently.
Of course the whole action takes longer when you execute a --refresh but that is only after dnf starts to work…

@nrj: I’d recommend running the command with a -v (–verbose) to maybe get more feedback telling you why and what dnf is waiting for. As I said, I have observed the same behaviour in the past, it just never bothered me enough to debug or follow up. It could be that dnf is already refreshing metadata in the background and since this can’t be done in parallel the second instance just waits for the first one to finish or so (just a random thought).

1 Like

I assume @vits95 is referring to a Virtual Terminal or Virtual Console (tty1, tty2, …) - that’s what you get when you hit CTRL + ALT +F3 (or F4, F5, …)

1 Like

hi @florian I executed sudo dnf update -v and got this result

also using --refresh takes 25 seconds to execute.

each time I run dnf update it checks for last metadata check

@vits95 using kernel console issues the same result

You have 3 third party repos enabled. Can you disable those and try again?

2 Likes

@ersen I disabled all the rpmfusion repos and only these are enabled now

Still it takes upto 25 seconds to execute

I cant disable mysql and metsploit repos as I want them to be updated with time.

How about sudo dnf check-update --cacheonly and sudo dnf upgrade --cacheonly?

1 Like

@ersen
Same results.
The thing is it takes this long to execute only the first time after booting the system.
After that it takes only 3 to 4 seconds to execute.
I think I have to live with that until fedora brings new update.

1 Like

I have the same when I go directly to the terminal and run dnf just after booting the system. I thought it was because of my old spinning hard drive and loading python modules for the first time after booting the system. There is libdnf written in C++, it is in development atm and I don’t know if dnf is currently using any of it, but it could make things faster in the future.