Bug 1279282 - [RFE] DNF should only update cache/metadata in the background, unless you specify otherwise.
[RFE] DNF should only update cache/metadata in the background, unless you spe...
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
Unspecified Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
: FutureFeature, Reopened
Depends On:
  Show dependency treegraph
Reported: 2015-11-08 21:45 EST by Andrew Toskin
Modified: 2016-08-10 03:14 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-08-09 04:21:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Andrew Toskin 2015-11-08 21:45:16 EST
## Description of problem:

DNF by default is already configured to periodically update the repo cache / metadata. So it's a little annoying when DNF stops to update the cache again when running certain commands, such as `repoquery`. Especially if you have enabled several external repositories, you may have to wait a while before you can get back to what you were doing.

## Possible solution:

DNF should only update its cache under two conditions:

1. Whenever DNF runs its periodic updates *in the background*.
2. When the user runs the `makecache` subcommand or adds the `--refresh` switch to the commandline.
Comment 1 Honza Silhan 2015-11-18 07:53:47 EST
3. when DNF consider them as expired (see metadata_expired [1] configuration option in /etc/dnf/dnf.conf).

You can set it to higher value or completely disable (-1)

[1] http://dnf.readthedocs.org/en/latest/conf_ref.html
Comment 2 Andrew Toskin 2015-11-18 23:23:41 EST
What? No, I don't want to disable automatic refreshing of the cached metadata. My point is that it's silly for commands like repoquery to trigger a refresh of all repositories, since dnf by default is already configured to look for updates in the background.

Perhaps we should look at it from another perspective: If a user wants to *manually* update the metadata, there are commands (makecache) and command switches (--refresh) to do so. However, if a user *does not* want to trigger extra refreshes, they have no options, and they will be forced to wait for repo information to download again when running certain dnf commands.
Comment 3 Andrew Toskin 2015-11-30 17:58:59 EST
Perhaps there is a better solution than the one I suggested, but I don't believe changing the time expire the metadata is it. So, I'm sorry, but I don't think Jan's response really addresses the problem.

Automatic background checks for updated metadata is already fine and good. Triggering *another* refresh for simple commands (such as a --what-provides for something already installed) forces the user to wait for what should be a very simple query. It's bad User Experience.
Comment 4 Fedora Admin XMLRPC Client 2016-07-08 05:35:39 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 5 Jaroslav Mracek 2016-08-08 07:45:30 EDT
I would like ask you about user that you use to run command ``dnf repoquery``. If you run it with root or sudo it use root's metadata cache, but if you run it like other user, you will see, that dnf download another cache. Same is applied for dnf clen command. You delete different cache if you run ``dnf clean all`` and ``sudo dnf clen all``.
Comment 6 Andrew Toskin 2016-08-08 19:35:41 EDT
I normally only run commands with sudo if it's required, so I run `dnf repoquery` as my regular user.

Maintaining a separate cache for each user seems silly: On a multi-user rig, anyone may be curious about the applications and dependencies installed on the system, but only one user account can install, remove, or upgrade packages.
Comment 7 Jaroslav Mracek 2016-08-09 04:21:32 EDT
Just think about cache problem. Just look at following questions. If every user will use only single cache - 
1. Can every user read single copy of cache - yes
2. Can every user modified or overwrite single copy of cache - no, this behavior could be a security problem. But if some user cannot modified cache, therefore they cannot download new metadata even if they are expired, corrupted or unavailable. Therefore some users can be very surprise. Also the present behavior has down-site like more space is required, presence of different versions of metadata can result in different results (commands that do not refresh metadata like with 'dnf list extras'). Also the solution could be to allow use of dnf only with root account, but it is even worse. I think there is not a perfect solution for this case. I can say feel free to help with dnf development, any contribution is welcome.

Anyway the present behavior is not a bug, therefore I am closing the report.
Comment 8 Andrew Toskin 2016-08-09 17:12:44 EDT
Sorry, Jaroslav, I didn't understand half of what you said. If only root can actually change packages, then what does it matter if other users make simple queries based on slightly out-of-date information? It is the administrator's responsibility to keep the cache and packages up-to-date. For other users, DNF queries merely satisfies their curiosity.

In fact, having only a single copy of the cache would also mean that it should *always* be up-to-date, because the dnf cache updater by default runs on a timer. If there were only one cache, everyone would always have the latest information!

Which brings me back to my point in the original post: Since dnf already regularly updates its cache in the background, triggering a cache update for repo queries and other commands is a waste of time.

I'm starting to feel bad for continually harping on this issue. I'm willing to be wrong here. But you haven't actually addressed the problem I'm talking about.

* DNF by default is set up to update its cache in the background.
* If the local administrator is really concerned, there are ways to force a metadata update, such as the makecache subcommand, or the --refresh flag.
* Therefore, why bother triggering updates *again* for dnf repoquery?
Comment 9 Jaroslav Mracek 2016-08-10 03:14:03 EDT
Thank you very much for your report. There are plans to change the behavior even with cooperation with other software management tools to use single copy of metadata, but we cannot promise any time period when it happen.

Note You need to log in before you can comment on or make changes to this bug.