I am using the dnf-plugin-local to help speed up DNF downloads for my virtual machines. It is working very well but only for downloading packages from the Fedora repos. Packages downloaded from third-party repos run into GPG issues, because normally the GPG keys are imported from the repo when a package is first installed. But since the third-party packages are coming from the local cache repo, no GPG key is imported (since they key doesn't live on my local machine).

Is there a command I can run for DNF that will force it to fetch and import all of the GPG keys specified in the repository settings so that I have the GPG keys in place for when DNF fetches third-party packages from the local repo?

1 Answer 1


So after digging around in the DNF source code, I came to the conclusion that this functionality doesn't exist. So I created it by modifying both dnf and dnf-plugins-core. Once those PRs are merged into their respective trunk branches and released, the following command will allow for GPG keys to be downloaded and imported into the RPM database, without having to do a package installation operation:

dnf config-manager --import-gpg-keys <repo>


dnf config-manager --import-gpg-keys --all
  • dnf config-manager: error: unrecognized arguments: --import-gpg-keys distro: Fedora release 37 (Thirty Seven) x86_64
    – Pysis
    Commented May 24, 2023 at 19:34
  • If you had read the answer in its entirety you would have seen that using that parameter depends on the PRs I linked to being merged.
    – wheeler
    Commented May 24, 2023 at 21:59
  • 1
    Showing it's still not, and spreading the error text to be searched.
    – Pysis
    Commented May 25, 2023 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .