Guidance about undoing the upgrade of a single package. For other up/downgrade topics, see Install, remove, and change software versions.

Before proceeding

Rolling back an upgrade is not supported, and requires many steps. Consider the side-effects of rollback, and whether it would be easier to report a bug and wait for a fix.

Check if package is from Debian

You can figure out if it's from Debian by typing apt info <program> | grep ^APT-Sources:. Compare the output for time (from Debian) and VSCode (from Microsoft):

$ apt info time | grep ^APT-Sources:
APT-Sources: https://deb.debian.org/debian bookworm/main amd64 Packages
$ apt info code | grep ^APT-Sources:
APT-Sources: https://packages.microsoft.com/repos/code stable/main amd64

Rolling back non-Debian packages may be more difficult - check if your vendor has guidance about it.

Figure out which package and version to rollback to

Check your /var/log/apt/history.log* files to see when your package was changed.

The following snippet shows an example log:

Start-Date: 2024-07-16  12:10:39
Commandline: /usr/bin/apt install /tmp/tmp.XN66P5KpTj.deb
Requested-By: kisaragi (1000)
Upgrade: time:amd64 (1.9-0.1, 1.9-0.2)
End-Date: 2024-07-16  12:10:43

If your problems started round about 2024-07-16, that would suggest version 1.9-0.2 of the time package is problematic and version 1.9-0.1 is fine.

Uninstall the problematic package

Remove package as usual: apt remove time

Note: you would not want to apt purge, as purging usually removes entire file including settings and configurations.

Note: if you are trying to uninstall nvidia-driver, you should install nouveau (installed by default) or mesa to log in to a graphical environment.

Find the applicable version of the package

Use the Debian snapshot archive to find older versions of Debian packages. For third-party packages, check if there is an older version in your local cache or on their server. Otherwise, please contact the repository administrator or their manual.

For version 1.9-0.1 of the time package:

  1. go to https://snapshot.debian.org/binary/time/

  2. click on 1.9-0.1

  3. find the right architecture for your machine
  4. click /pool/main/t/time

You may be able to install the package directly, but if your package depends on a specific version of another package that has also been upgraded, you will need an apt repository to resolve all the dependencies.

Set up snapshot repository

The package is from Debian, so we can use Debian's snapshot repository.

You should see something like https://snapshot.debian.org/archive/debian/20221008T025242Z/pool/main/t/time/ in your browser.

Copy https://snapshot.debian.org/archive/debian/20221008T025242Z/ and open /etc/apt/sources.list with your favorite editor.

Append:

deb https://snapshot.debian.org/archive/debian/20221008T025242Z/ main contrib non-free non-free-firmware

If you want to disable all new Debian packages, you can also comment out the following line:

deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware

Save the file when you're done.

obtain older package

As usual, type apt update to teach apt about the older package.

install older package

Type apt install time=1.9-0.1 to install the exact verison you want. You may encounter with broken dependency error; it may require additional steps.

Pin the packages to prevent upgrade

Type apt-mark hold time to stop apt upgrade etc. from upgrading the package.

Make bug report about the regression

File a bug report to Debian if the reason is some regression, or the package is from Debian.

Deb822.Sources Example

/etc/apt/sources.list.d/snapshot-20241130.sources

Types: deb deb-src
URIs: https://snapshot.debian.org/archive/debian/20241130
Suites: trixie
Components: main contrib non-free non-free-firmware
Check-Valid-Until: false
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: https://snapshot.debian.org/archive/debian-security/20241130
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Check-Valid-Until: false
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

/etc/apt/preferences.d/snapshot-20241130

# We don't want anything from this version
Package: linux-image-*
Pin: version 6.12*
Pin-Priority: -1

# This could also be 50 like below..
Package: linux-*
Pin: version 6.11.10*
Pin-Priority: 300

# We should set something for the rest and < 100 is always good if it will only be handled manually.
Package: *
Pin: release a=trixie
Pin: origin snapshot.debian.org
Pin-Priority: 50


CategoryPackageManagement CategoryDebugging