Unable to use the dnf system cache from a user account

Hello,

dnf provides --cacheonly to allow regular users to do read-only operations on the system cache. This avoids having to build separate package caches for each user, which can take a relatively long time if you’re only searching for or looking at packages metadata.

On my machine, I’m unable to use the system cache as a regular user, even after rebuilding a fresh one (example below for clang, but the same applies for any package):

$ sudo dnf clean all
83 files removed

$ sudo dnf --refresh makecache
Fedora Modular 31 - x86_64
Fedora Modular 31 - x86_64 - Updates
Fedora 31 - x86_64 - Updates
Fedora 31 - x86_64
google-chrome
RPM Fusion for Fedora 31 - Free - Updates
RPM Fusion for Fedora 31 - Free - Updates                                                                             438 kB/s | 435 kB     00:00
RPM Fusion for Fedora 31 - Free                                                                                        10 kB/s | 663 kB     01:06
RPM Fusion for Fedora 31 - Nonfree - Updates                                                                          3.2 kB/s | 102 kB     00:32
RPM Fusion for Fedora 31 - Nonfree                                                                                    149 kB/s | 241 kB     00:01
Fish shell - 3.x release series (Fedora_31)                                                                            67 kB/s |  34 kB     00:00
slack                                                                                                                  17 kB/s |  38 kB     00:02
Visual Studio Code                                                                                                    916 kB/s | 4.2 MB     00:04
Metadata cache created.

$ dnf -C search clang
Error: Cache-only enabled but no cache for 'fedora-modular'

Of course, the same command succeeds if running without -C (after updating the user cache) or as root:

$ sudo dnf -C search clang                                                                                               673ms  13:05
Last metadata expiration check: 0:00:38 ago on Wed 13 May 2020 13:05:20 BST.
============================================================ Name Exactly Matched: clang =============================================================
clang.x86_64 : A C language family front-end for LLVM

What could be going wrong here?

Thanks.

I did the same steps, clean all, make cache, search as a user with -C option and I didn’t get the error yo got.

Error: Cache-only enabled but no cache for ‘fedora-modular’

I don’t have modular repos enabled, so it could be the reason.

1 Like