Bug 2324177 - dnf5 does not expire metadata before makecache
Summary: dnf5 does not expire metadata before makecache
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: rpm-software-management
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-11-06 14:05 UTC by Tomáš Bajer
Modified: 2025-07-31 02:03 UTC (History)
7 users (show)

Fixed In Version: dnf5-5.2.14.0-1.fc43 dnf5-5.2.15.0-2.fc42 dnf5-5.2.15.0-2.fc41
Clone Of:
Environment:
Last Closed: 2025-07-31 00:53:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tomáš Bajer 2024-11-06 14:05:14 UTC
DNF4 does not require manual `dnf clean X` step (9). Just `dnf makecache` is enough for the installer to realize there has been a change made in the repository.

DNF5 however does not expire the metadata after second run of `createrepo` and therefore does not mandate its refresh.

Reproducible: Always

Steps to Reproduce:
1. mkdir /var/www/html/localrepo
2. place $package there
3. createrepo /var/www/html/localrepo
4. proper entry in /etc/yum.repos.d/localrepo
5. `dnf install $package` works => remove package.rpm from repo
6. createrepo /var/www/html/localrepo again
7. dnf makecache
8. `dnf install $package` tries to install $package from localrepo, then fails with 
Librepo error: Cannot download $package.rpm: All mirrors were tried
9. dnf clean all/metadata/expire-cache
10. dnf makecache (optional)
11. dnf install $package => works as intended (meaning regular error)

Actual Results (at step 8):  
Updating and loading repositories:
Repositories loaded.
Package                                        Arch        Version                                         Repository                     Size
Installing:
 package                                           x86_64      5.9-15.fc41                                     localrepo                   7.9 MiB

Transaction Summary:
 Installing:         1 package

Total size of inbound packages is 3 MiB. Need to download 3 MiB.
After this operation, 8 MiB extra will be used (install 8 MiB, remove 0 B).
Is this ok [y/N]: y
[1/1] package-0:5.9-15.fc41.x86_64                                                                          0% |   0.0   B/s |  -1.0   B |  ?     
>>> Curl error (37): Could not read a file:// file for file:///var/www/html/localrepo/package-5.9-15.fc41.x86_64.rpm [Couldn't open file /var/www/
>>> No more mirrors to try - All mirrors were already tried without success
----------------------------------------------------------------------------------------------------------------------------------------------
[1/1] Total                                                                                           ???% |   0.0   B/s |  -1.0   B |  00m00sFailed to download packages
 Librepo error: Cannot download package-5.9-15.fc41.x86_64.rpm: All mirrors were tried


Expected Results:  

Last metadata expiration check: 0:00:02 ago on Wed 06 Nov 2024 08:58:13 AM EST.
No match for argument: package
Error: Unable to find a match: package


I am not sure whether this is a bug or intended behavior, however this is a difference between dnf4 and dnf5. With dnf4 step 8 would already give the proper error (Unable to find a match)

Comment 1 Jaroslav Rohel 2024-11-25 08:41:48 UTC
`dnf5 makecache` does not update valid (non-expired) caches.
Updates of non-expired caches can be forced using the `--refresh` argument -> `dnf5 --refresh makecache`.

It's an improvement. In dnf5 we can create/update invalid caches without modifying non-expired ones. If we want to update even non-expired ones, we add `--refresh`.

`--refresh` is universal and can be added to other commands as well. For example, `dnf --refresh download package`. We call the `dnf makecache` command when we only want to update caches and nothing more. For example, regularly in cron so that the user has valid caches.

The new `makecache` behaviour is more flexible. However, it is a change from dnf4. So we need to either document the change or, as part of compatibility with the old version, change the behavior of dnf5 so that the `makecache` command also updates unexpired caches - as if the `--refresh` argument were present.

Comment 2 Jaroslav Rohel 2024-11-25 14:46:17 UTC
Update:

In the DNF4 documentation it is mentioned about `makecache`:
Downloads and caches metadata for enabled repositories. Tries to avoid downloading whenever possible (e.g. when the local metadata hasn't expired yet or when the metadata timestamp hasn't changed).

So DNF5 behaviour is not new. It is compatible with the DNF4 documentation. 
The bug is in DNF4, which behaves differently from the documentation.

Comment 3 Evan Goode 2025-05-22 21:08:16 UTC
I created https://github.com/rpm-software-management/dnf/issues/2242 to document the flaw in DNF4 and https://github.com/rpm-software-management/dnf5/pull/2257 to update the changes_from_dnf4 document.

Comment 4 Fedora Update System 2025-07-16 08:35:31 UTC
FEDORA-2025-a5e5885906 (dnf5-5.2.15.0-1.fc42 and librepo-1.20.0-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-a5e5885906

Comment 5 Fedora Update System 2025-07-16 08:36:06 UTC
FEDORA-2025-fb095dd283 (dnf5-5.2.15.0-1.fc41 and librepo-1.20.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-fb095dd283

Comment 6 Fedora Update System 2025-07-17 00:58:41 UTC
FEDORA-2025-a5e5885906 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-a5e5885906`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-a5e5885906

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2025-07-17 01:07:36 UTC
FEDORA-2025-fb095dd283 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-fb095dd283`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-fb095dd283

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2025-07-24 14:59:05 UTC
FEDORA-2025-9ae670b810 (dnf5-5.2.15.0-2.fc42 and librepo-1.20.0-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-9ae670b810

Comment 9 Fedora Update System 2025-07-24 15:00:10 UTC
FEDORA-2025-fdcda3af30 (dnf5-5.2.15.0-2.fc41 and librepo-1.20.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-fdcda3af30

Comment 10 Fedora Update System 2025-07-25 02:13:30 UTC
FEDORA-2025-9ae670b810 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-9ae670b810`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-9ae670b810

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2025-07-25 02:26:12 UTC
FEDORA-2025-fdcda3af30 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-fdcda3af30`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-fdcda3af30

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2025-07-31 00:53:05 UTC
FEDORA-2025-9ae670b810 (dnf5-5.2.15.0-2.fc42 and librepo-1.20.0-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2025-07-31 02:03:56 UTC
FEDORA-2025-fdcda3af30 (dnf5-5.2.15.0-2.fc41 and librepo-1.20.0-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


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