How to roll back a failed update?

Rolling back a failed update depends on the package manager and the Linux distribution you are using. Here are some common methods for different systems:

For Debian/Ubuntu (using APT)

  1. Using APT:
    If an update fails, you can revert to the previous version of a package using:

    sudo apt install package-name=version

    To find the available versions of a package, use:

    apt-cache showpkg package-name
  2. Using dpkg:
    If you have a .deb file of the previous version, you can install it directly:

    sudo dpkg -i /path/to/package.deb

For Red Hat/CentOS (using Yum or DNF)

  1. Using DNF:
    You can roll back to a previous version of a package with:

    sudo dnf downgrade package-name

    To see the history of transactions, use:

    sudo dnf history

    You can then roll back to a specific transaction:

    sudo dnf history undo transaction-id
  2. Using Yum:
    Similar to DNF, you can downgrade a package:

    sudo yum downgrade package-name

General Considerations

  • Backups: Always maintain regular backups of your system to restore it in case of critical failures.
  • Snapshots: If you are using a filesystem that supports snapshots (like Btrfs or LVM), you can revert to a snapshot taken before the update.
  • Logs: Check logs (like /var/log/dpkg.log for APT or /var/log/yum.log for Yum) to identify what went wrong during the update.

These methods will help you roll back a failed update on your Linux system.

0 Comments

no data
Be the first to share your comment!