RPM Downgrade in Linux (yum, rpm, Install Specific Version + Rollback)

RPM Downgrade in Linux (yum, rpm, Install Specific Version + Rollback)

Downgrading an RPM package in Linux is useful when a recent update causes compatibility issues or breaks applications. In this guide, you will learn how to downgrade RPM packages using yum and rpm, install specific versions, and safely handle dependencies and rollback scenarios.


Check Installed and Available RPM Versions

Before downgrading any package, always verify the current version and available versions. This helps avoid installing the wrong version and breaking dependencies.

Check installed package version using rpm

Use the following command to check the currently installed version:

bash
rpm -qa | grep <package-name>

Example:

bash
rpm -qa | grep bash

You will see output like:

bash
bash-4.2.46-29.el7_4.x86_64

This confirms the currently installed version.

List all available versions using yum or dnf

To safely downgrade, you must first check which versions are available in your repository.

bash
yum list --showduplicates <package-name>

OR (for newer systems):

bash
dnf list --showduplicates <package-name>

Example:

bash
yum list --showduplicates bash

This will show all available versions:

bash
bash.x86_64   4.2.46-28.el7   repo
bash.x86_64   4.2.46-31.el7   repo

Identify correct version before downgrade

Before proceeding:

  • Choose a version that is stable and compatible
  • Avoid downgrading core packages blindly (like glibc, systemd)
  • Prefer versions from official repositories
  • Ensure the version is not too old, which may break dependencies

yum downgrade is the safest method because it handles dependencies automatically.

Downgrade using local RPM file

If you already have the older RPM file:

bash
yum downgrade /path/to/package.rpm

Example:

bash
yum downgrade /tmp/bash-4.2.46-28.el7.x86_64.rpm

Downgrade using repository version

If the version exists in your repo:

bash
yum downgrade <package-name>-<version>

Example:

bash
yum downgrade bash-4.2.46-28.el7.x86_64

Skip confirmation using -y option

To avoid manual confirmation:

bash
yum downgrade -y bash-4.2.46-28.el7.x86_64

Verify downgrade success

Always verify after downgrade:

bash
rpm -qa | grep <package-name>

Example:

bash
rpm -qa | grep bash

Important safety tips (DO NOT SKIP)

  • Always test on a non-production system first
  • Avoid downgrading multiple packages at once
  • Do not interrupt the downgrade process
  • Ensure system has internet access (for dependencies)

Install Specific Version of Package Using yum

Sometimes you don’t need a downgrade — you just want to install a specific version.

Install exact version from repository

Use:

bash
yum install <package-name>-<version>

Example:

bash
yum install bash-4.2.46-28.el7.x86_64

Prevent automatic upgrade during install

After installing a specific version, prevent it from being upgraded:

Install versionlock plugin:

bash
yum install yum-plugin-versionlock

Lock the package:

bash
yum versionlock add <package-name>

Example:

bash
yum versionlock add bash

Handle multiple versions availability

If multiple versions exist:

bash
yum list --showduplicates <package-name>

Then choose the exact version carefully.


Downgrade RPM Using rpm Command (Force Method)

The rpm command can be used to downgrade packages directly, but this method does NOT handle dependencies automatically. Use this only when you are sure about the package compatibility.

Syntax using --oldpackage option

Use the following command to downgrade:

bash
rpm -Uvh /path/to/package.rpm --oldpackage

Example:

bash
rpm -Uvh /tmp/bash-4.2.46-28.el7.x86_64.rpm --oldpackage

This will replace the newer version with the older one.

Difference between --oldpackage and --force

  • --oldpackage
    Allows installing an older version over a newer one (safe for downgrade)

  • --force
    Forces installation regardless of conflicts (NOT recommended)

Example of force (avoid unless necessary):

bash
rpm -Uvh /path/to/package.rpm --force

Risks of forcing RPM downgrade

Using rpm without dependency handling can lead to:

  • Broken dependencies
  • Application crashes
  • System instability
  • Package conflicts

Beginner advice:

  • Prefer yum downgrade over rpm
  • Use rpm only when:
    • No repo version is available
    • You fully understand dependencies

Downgrade Package with Dependencies Handling

When downgrading packages, dependency management is critical to avoid breaking the system.

How yum resolves dependencies automatically

When you use:

bash
yum downgrade <package>

Yum will:

  • Check required dependencies
  • Downgrade dependent packages if needed
  • Prevent unsafe operations

This makes it the safest option.

What happens when dependencies mismatch

You may encounter errors like:

bash
Error: Package: xyz requires abc >= version

This means:

  • The older version depends on a different version of another package
  • Downgrade cannot proceed safely

Fix dependency issues during downgrade

Follow these steps:

  1. Check dependency requirements:
bash
repoquery --requires <package-name>
  1. Downgrade dependent packages together:
bash
yum downgrade package1 package2
  1. Use yum shell for controlled downgrade:
bash
yum shell

Inside shell:

bash
downgrade <package>
run
  1. If needed, temporarily disable conflicting repos:
bash
yum --disablerepo=<repo-name> downgrade <package>

Beginner tip:

  • Never ignore dependency errors
  • Avoid using --nodeps unless absolutely necessary

Rollback RPM Package After Update

If a recent update caused issues, you can rollback using yum history.

Using yum history undo

Check transaction history:

bash
yum history

Undo a specific transaction:

bash
yum history undo <ID>

Example:

bash
yum history undo 10

Using yum history rollback

Rollback to a previous state:

bash
yum history rollback <ID>

Example:

bash
yum history rollback 8

This will revert all changes after that transaction.


Limitations of rollback in RPM-based systems

  • Works only if history is available
  • Not all dependencies may revert cleanly
  • May fail if packages are no longer available in repo
  • Not reliable for major system upgrades

Beginner advice:

  • Use rollback for small changes only
  • For critical systems, prefer backup/restore

Prevent Package Upgrade After Downgrade

After downgrading, you may want to prevent automatic upgrades.

Install yum-plugin-versionlock

Install plugin:

bash
yum install yum-plugin-versionlock

For newer systems:

bash
dnf install 'dnf-command(versionlock)'

Lock package version using yum versionlock

Lock a package:

bash
yum versionlock add <package-name>

Example:

bash
yum versionlock add bash

Verify locked packages

Check locked packages:

bash
yum versionlock list

Example output:

bash
bash-0:4.2.46-28.el7.*
IMPORTANT
  • Locked packages will not be upgraded during yum update
  • Useful for production systems where stability is critical

Frequently Asked Questions

1. How do I downgrade an RPM package in Linux?

You can downgrade an RPM package using yum downgrade or rpm -Uvh <package.rpm> --oldpackage. Yum is recommended as it handles dependencies automatically.

2. How to install a specific version of a package using yum?

Use yum install package-version to install a specific version. You can list available versions using yum list --showduplicates.

3. What is the difference between yum and rpm for downgrade?

Yum resolves dependencies automatically, while rpm performs a direct installation. Yum is safer for most use cases, whereas rpm is used for manual or forced downgrades.

4. Can I rollback a package update in Linux?

Yes, you can use yum history undo or yum history rollback to revert package updates if the transaction history is available.

5. How to prevent package upgrade after downgrade?

You can lock the package version using yum versionlock add to prevent it from being upgraded automatically.

Summary

Downgrading RPM packages can help resolve compatibility issues, but it must be done carefully. Use yum downgrade whenever possible, as it safely handles dependencies. The rpm command should be used only for advanced or manual scenarios. Always verify versions, check dependencies, and consider locking packages after downgrade to prevent unintended upgrades.


Official Documentation

Deepak Prasad

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.