`dnf info` takes a lot of time and downloads a lot of data everytime

As seen in the following, dnf info takes a lot of time and downloads a lot of data everytime . Any solutions to avoid downloading so much everytime:

$ dnf info gifsicle
Copr repo for PyCharm owned by phracek                      3.5 kB/s | 2.1 kB     00:00    
Fedora 38 - x86_64 - Updates                                187 kB/s |  16 kB     00:00    
Fedora 38 - x86_64 - Updates                                4.9 MB/s | 4.3 MB     00:00    
Fedora Modular 38 - x86_64 - Updates                        230 kB/s |  17 kB     00:00    
google-chrome                                                15 kB/s | 1.3 kB     00:00    
google-chrome                                                20 kB/s | 3.6 kB     00:00    
RPM Fusion for Fedora 38 - Free - Updates                    12 kB/s | 6.4 kB     00:00    
RPM Fusion for Fedora 38 - Free - Updates                   290 kB/s | 164 kB     00:00    
RPM Fusion for Fedora 38 - Nonfree - NVIDIA Driver           21 kB/s | 6.9 kB     00:00    
RPM Fusion for Fedora 38 - Nonfree - NVIDIA Driver           36 kB/s |  15 kB     00:00    
RPM Fusion for Fedora 38 - Nonfree - Steam                   10 kB/s | 6.0 kB     00:00    
RPM Fusion for Fedora 38 - Nonfree - Updates                 11 kB/s | 6.5 kB     00:00    
RPM Fusion for Fedora 38 - Nonfree - Updates                 90 kB/s |  69 kB     00:00    
Visual Studio Code                                           12 kB/s | 1.5 kB     00:00    
Visual Studio Code                                          6.5 MB/s |  36 MB     00:05    
Available Packages
Name         : gifsicle
Version      : 1.93
Release      : 5.fc38
Architecture : x86_64
Size         : 157 k
Source       : gifsicle-1.93-5.fc38.src.rpm
Repository   : fedora
Summary      : Powerful program for manipulating GIF images and animations
URL          : http://www.lcdf.org/gifsicle/
License      : GPLv2+
Description  : Gifsicle is a command-line tool for creating, editing, and getting
             : information about GIF images and animations.
             : Some more gifsicle features:
             :     * Batch mode for changing GIFs in place.
             :     * Prints detailed information about GIFs, including comments.
             :     * Control over interlacing, comments, looping, transparency...
             :     * Creates well-behaved GIFs: removes redundant colors, only uses local
             :       color tables if it absolutely has to (local color tables waste space
             :       and can cause viewing artifacts), etc.
             :     * It can shrink colormaps and change images to use the Web-safe palette
             :       (or any colormap you choose).
             :     * It can optimize your animations! This stores only the changed portion
             :       of each frame, and can radically shrink your GIFs. You can also use
             :       transparency to make them even smaller. Gifsicle?s optimizer is pretty
             :       powerful, and usually reduces animations to within a couple bytes of
             :       the best commercial optimizers.
             :     * Unoptimizing animations, which makes them easier to edit.
             :     * A dumb-ass name.
             : One other program is included with gifsicle
             : and gifdiff compares two GIFs for identical visual appearance.

It’s not every time. If you use dnf info again now, it won’t update the metadata cache.

The cache is only updated when:

  1. the dnf command requires it (not all dnf commands do), AND
  2. the cache is stale (expired), according to the time set in the repo (usually 1 day for updates repo)

The system cache is also updated in the background with a timer.

The issue is that dnf has multiple caches: the system cache (used by root), and per-user caches. So if you do these 2 commands, they’re hitting different copies of the cache and need to be updated separately:

sudo dnf info foo
dnf info foo

To avoid this, you can either always use dnf as root, or use dnf as your normal user but read from the system cache.

Use dnf with system cache only

I have this in my aliases:

alias dnf='dnf -C'

So dnf (as my normal user) always uses the system cache. Note this is read-only, so if the system cache is stale, the normal user cannot update it.

Now if I run these 2 commands:

sudo dnf info foo
dnf info foo

The first command with sudo will update the system cache (if it is stale), and the second command will read from the system cache (but never update it).

Once you have this set up and tested working, you can clean the user cache (and never use it again):

\dnf clean all

The leading slash \ means “don’t interpret this as an alias”, so I’m actually running dnf clean all instead of dnf -C clean all (which would not work, because the user cannot clean the system cache).

Obvious caveat: if your cache is stale, you may be looking at the wrong info (like version numbers of available updates). You need root to update the cache.


But as you said the dnf system cache is updated atleast once a day. Right? So this point is not very important. Am i correct?

That’s correct. For most user’s it’s probably not important.

1 Like

Disable repos that you don’t need and delete duplicate repos.

1 Like

There are no duplicate repos here.

Sometimes repos are shown twice; the 1st line is always much smaller, which is a clue the two lines are different things (repo metadata then package metadata), not the same thing twice.

The Nvidia and Steam repos are redundant if you have the full RPM Fusion Nonfree repos enabled, you can disable the first two @lamyer (they’re meant for people who only want those software without enabling the full Nonfree repo)

You can also disable modular repos if you don’t use them.


I solve it this way, using always sudo for dnf:

1 Like

If you run dnf as a non-root user you don’t use the cache data but instead use a per-user cache found in /var/tmp. Only if you run dnf -C will you use the already cached data without updating it.

… and

Copr repo for PyCharm owned by phracek

if you don’t use it.

I didn’t even install pycharm. Does Fedora installs it by default?

Fedora does enable that repo (and google chrome and the rpmfusion Nvidia and steam repos), when you select to install Third-party repos during install.

1 Like

@jn64 I did

$ dnf repository-packages fedora-modular list
Last metadata expiration check: 3:50:11 ago on Fri 16 Jun 2023 11:01:06 CEST.
$ dnf repository-packages updates-modular list
Last metadata expiration check: 3:52:31 ago on Fri 16 Jun 2023 11:01:06 CEST.

does that mean that these repositories have no package? if so, what is its purpose?

Modular is used to provide different versions (streams) of certain packages, usually related to programming languages or development tools.

dnf module list
dnf module list --enabled

You would know if you use it for something like nodejs or posgresql. Some third party repos (notably Nvidia’s own CUDA repos) use modules.

Not sure about repository-packages interaction with modular, I don’t typically use it. Maybe a module stream has to be enabled for it to show.

To disable repos:

sudo dnf config-manager --set-disabled <repoid...>

You can use wildcards (be careful when using it to enable, there might be debug/source repos of the same name which you don’t intend to enable):

sudo dnf config-manager --set-disabled *modular*

List repos:

dnf repolist
dnf repolist --all

The Python IDE
for Professional Developers

Thanks for pointing out all this infos.

I am wondering if there is also a command where we can distinguish between a list and and infos as we do have by the packages?

I do answer to my selves: Yes:

sudo dnf repoinfo copr:copr.fedorainfracloud.org:phracek:PyCharm

Last metadata expiration check: 1:16:24 ago on Fri 16 Jun 2023 09:25:04 AM -03.
Repo-id            : copr:copr.fedorainfracloud.org:phracek:PyCharm
Repo-name          : Copr repo for PyCharm owned by phracek
Repo-status        : enabled
Repo-revision      : 1684844572
Repo-updated       : Tue 23 May 2023 09:23:04 AM -03
Repo-pkgs          : 8
Repo-available-pkgs: 8
Repo-size          : 2.0 G
Repo-baseurl       : https://download.copr.fedorainfracloud.org/results/phracek/PyCharm/fedora-38-x86_64/
Repo-expire        : 172,800 second(s) (last: Fri 16 Jun 2023 09:24:46 AM -03)
Repo-filename      : /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:phracek:PyCharm.repo
Total packages: 8

Unfortunately a info text who describes what the repo is for I did not find.
While searching in internet I found this: