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.
(And I should add that I ran `sudo dnf makecache` just prior.)
[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 ~]$
[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.
I created a patch that should change dnf behavior with -C option (https://github.com/rpm-software-management/dnf/pull/876).
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
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
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.