5

When I use the dnf command, it starts to update repositories and it takes a while, especially when the OS is outdated. Sometimes I need to use dnf info or something like that and I don't need it to be updated. How can I use it in a way it does not search for update?

1
  • An alternative option is to learn the rpm commands that are local-only, e.g. rpm -qi packagename to get the info on an installed package. Commented Jul 18, 2020 at 18:20

2 Answers 2

16

Use the --cacheonly (or -C) option; this will use the system cache only, without updating it.

0

Using --setopt=metadata_expire=never never mark metadata as expired, you may get old version of package or download failed (old package may be deleted in repo server).

dnf install --setopt=metadata_expire=never <package> 

Using --cacheonly aka -C only use cache, if you never dnf install or dnf download the package before to cache it, this will fail. And this swicth never updates metadata for sure.

dnf install -C <package> 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.