88

I want to install an older version of package <x>, and when I use dnf it only shows the current version of the package <x>.

Is there any way to install an older versions using dnf ?

3 Answers 3

112

You can install using a specific name-version as described in the man page:

dnf install tito-0.5.6-1.fc22

Install package with specific version. If the package is already installed it will automatically try to downgrade or upgrade to specific version.

To view all versions of a package in your enabled repositories, use:

dnf --showduplicates list <package>
4
  • 1
    Does not work, dnf cannot find the version of the package I just upgraded from.
    – wheeler
    Commented Nov 25, 2022 at 16:18
  • The fact that the previous version was just upgraded has nothing to do with it’s availability in the repos. Did you try the showduplicates command? Was it available before the upgrade? I understand it was already installed, that doesn’t necessitate it was present in the repos.
    – Dani_l
    Commented Nov 27, 2022 at 11:49
  • I believe what Dani is saying is that the list command you give in your answer does not show any previous versions of a package. AFAICT it only shows the current version. Have you tried it? Commented Jan 2 at 17:47
  • @AlvinThompson It's not just previous versions. If a particular version is not in the repo, then it won't show, even if it was previously installed. This is an issue with packages installed directly (not from a repo) as well as particular versions having been pulled off from repos due to various reasons (mostly security related).
    – Dani_l
    Commented Jan 4 at 7:02
31

Yes. You can install older version of package using dnf downgrade package-name[-version] if you already installed new one. But the old version still needs to be available on mirrors.

If the package is not available from mirrors, you can always download it manually from koji and then use dnf to downgrade such as dnf downgrade path/to/downloaded.file.rpm. But with this technique, you might need to resolve dependencies on your own.

6
  • Also keep in mind, that installing packages manually has the disadvantage of not getting any updates (say security fixes) for that package, provided there are any.
    – Thorian93
    Commented Oct 30, 2019 at 10:25
  • This is not installing packages manually, but just manually downloading them. Anytime you run dnf update you will get the updates including security fixes.
    – Jakuje
    Commented Oct 30, 2019 at 11:49
  • 1
    Are you sure about that? I am genuinely curious as I always thought installing an .rpm directly leaves me responsible for installing updated versions of it. Unless the .rpm itself installs its own repository. Can you give a reference for your statement?
    – Thorian93
    Commented Oct 30, 2019 at 14:26
  • 3
    It works that way if you install either a package that is not packaged in your system (from somewhere else) or if you install some newer version than is provided by your system. This particular use case installs an older RPM, from koji (official build system), which means it is most probably included in Fedora and older version so any future update updates it.
    – Jakuje
    Commented Oct 30, 2019 at 14:39
  • 2
    You can also install older version of a package from koji with dnf install path/to/downloaded.file.rpm.
    – ks1322
    Commented Jan 9, 2020 at 15:06
10

You can perform a simple downgrade by:

sudo dnf downgrade <package-name>

For instance:

sudo dnf downgrade podman

You must log in to answer this question.

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