Bug 1473964 - dnf -C (or dnf --cacheonly) does not work as documented for a regular user
dnf -C (or dnf --cacheonly) does not work as documented for a regular user
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
26
Unspecified Unspecified
medium Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-22 15:56 EDT by Matthew Miller
Modified: 2017-08-09 11:59 EDT (History)
7 users (show)

See Also:
Fixed In Version: dnf-2.6.3-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-09 11:59:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matthew Miller 2017-07-22 15:56:59 EDT
From the man page:

       -C, --cacheonly
              Run entirely from system cache, don't update the cache
              and  use it even in case it is expired.

              DNF uses a separate cache for each user under which it
              executes. The cache for the root user is called the
              system cache. This switch allows a regular user read-only
              access to the system cache which usually is more fresh
              than the user's and thus he does not have to wait for
              metadata sync.


but in practice:

    $ dnf clean metadata
    Cache was expired
    0 files removed
    $ dnf -C info
    Error: Cache-only enabled but no cache for 'updates-testing'


I would expect that when using `dnf -C`, the system cache would be used. In fact, I would argue that the system cache should be _preferred_ when available, to avoid duplicate downloads, but that is probably a separate RFE.
Comment 1 Matthew Miller 2017-07-22 16:04:02 EDT
(And I should add that I ran `sudo dnf makecache` just prior.)
Comment 2 Chris Murphy 2017-07-22 16:13:37 EDT
[chris@f26s ~]$ dnf -C search hello
Error: Cache-only enabled but no cache for 'updates-testing'
[chris@f26s ~]$ ls -l /var/cache/dnf
total 106712
-rw-r--r--. 1 root root        2 Jul 22 13:50 expired_repos.json
drwxr-xr-x. 1 root root       56 Jul 22 12:52 fedora-6dbd63560daef6bf
-rw-r--r--. 1 root root 40995822 Jul 22 12:53 fedora-filenames.solvx
-rw-r--r--. 1 root root 19892408 Jul 22 12:53 fedora.solv
-rw-r--r--. 1 root root        0 Jul 22 13:50 last_makecache
-rw-r--r--. 1 root root  5951488 Jul 22 13:04 packages.db
-rw-r--r--. 1 root root        2 Jun 24 11:49 tempfiles.json
drwxr-xr-x. 1 root root       56 Jul 22 12:51 updates-2854b3113b7a3c6c
-rw-r--r--. 1 root root  5492192 Jul 22 12:51 updates-filenames.solvx
-rw-r--r--. 1 root root   484663 Jul 22 12:51 updates-presto.solvx
-rw-r--r--. 1 root root  1493414 Jul 22 12:53 updates.solv
drwxr-xr-x. 1 root root       56 Jul 22 12:50 updates-testing-b081e891bd0bf8fd
-rw-r--r--. 1 root root 18686939 Jul 22 12:50 updates-testing-filenames.solvx
-rw-r--r--. 1 root root  2405887 Jul 22 12:50 updates-testing-presto.solvx
-rw-r--r--. 1 root root  7285724 Jul 22 12:53 updates-testing.solv
-rw-r--r--. 1 root root  5438929 Jul 22 12:51 updates-testing-updateinfo.solvx
-rw-r--r--. 1 root root  1119945 Jul 22 12:51 updates-updateinfo.solvx
[chris@f26s ~]$
Comment 3 Chris Murphy 2017-07-22 16:14:58 EDT
[chris@f26s ~]$ dnf -Cv search hello
Loaded plugins: builddep, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repograph, repomanage, reposync, system-upgrade
DNF version: 2.5.1
cachedir: /var/tmp/dnf-chris-2qrmnhfh
Error: Cache-only enabled but no cache for 'updates-testing'


Yep it's very clearly looking in the wrong cache location.
Comment 4 Jaroslav Mracek 2017-07-27 10:16:28 EDT
I created a patch that should change dnf behavior with -C option (https://github.com/rpm-software-management/dnf/pull/876).
Comment 5 Fedora Update System 2017-08-07 08:50:09 EDT
dnf-2.6.3-1.fc26 dnf-plugins-extras-2.0.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4813633f96
Comment 6 Fedora Update System 2017-08-07 21:24:15 EDT
dnf-2.6.3-1.fc26, dnf-plugins-extras-2.0.2-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4813633f96
Comment 7 Fedora Update System 2017-08-09 11:59:37 EDT
dnf-2.6.3-1.fc26, dnf-plugins-extras-2.0.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, 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.