Skip to content

Instantly share code, notes, and snippets.

@cgomesu
Created February 2, 2023 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgomesu/70b41cfde804d4a2981029f9f71f8908 to your computer and use it in GitHub Desktop.
Save cgomesu/70b41cfde804d4a2981029f9f71f8908 to your computer and use it in GitHub Desktop.
Downgrading packages in APT-based distros

How to downgrade a package in APT-based distros

  1. Check latest package upgrades in /var/log/dpkg.log:

    cat /var/log/dpkg.log | grep -i upgrade

    which should output something like this:

    2023-02-02 08:48:31 upgrade docker-ce-cli:amd64 5:20.10.23~3-0~debian-bullseye 5:23.0.0-1~debian.11~bullseye
    2023-02-02 08:48:32 upgrade docker-ce:amd64 5:20.10.23~3-0~debian-bullseye 5:23.0.0-1~debian.11~bullseye
    2023-02-02 08:48:34 upgrade docker-ce-rootless-extras:amd64 5:20.10.23~3-0~debian-bullseye 5:23.0.0-1~debian.11~bullseye
  2. Then, to downgrade, say, the docker-ce-cli package back to its previous version, run apt install and specify the older version:

    sudo apt install docker-ce-cli:amd64=5:20.10.23~3-0~debian-bullseye

    which should indicate that you're attempting to revert the package. Follow instructions and that's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment