Debian can rollback upgrade, but it requires many steps.
Before proceeding
You would have to consider the side-effect of rollback.
Check if package is from Debian
You can figure out if it's from Debian by typing apt info and seeing its APT-Sources. Here's example output from VSCode (https://code.visualstudio.com/docs/setup/linux):
$ apt info code Package: code Version: 1.91.1-1720564633 Priority: optional Section: devel Maintainer: Microsoft Corporation <vscode-linux@microsoft.com> Installed-Size: 398 MB Provides: visual-studio-code Depends: ca-certificates, libasound2 (>= 1.0.17), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatspi2.0-0 (>= 2.9.90), libc6 (>= 2.14), libc6 (>= 2.16), libc6 (>= 2.17), libc6 (>= 2.2.5), libc6 (>= 2.28), libcairo2 (>= 1.6.0), libcurl3-gnutls | libcurl3-nss | libcurl4 | libcurl3, libdbus-1-3 (>= 1.9.14), libdrm2 (>= 2.4.75), libexpat1 (>= 2.1~beta3), libgbm1 (>= 17.1.0~rc2), libglib2.0-0 (>= 2.37.3), libgssapi-krb5-2 (>= 1.17), libgtk-3-0 (>= 3.9.10), libgtk-3-0 (>= 3.9.10) | libgtk-4-1, libkrb5-3 (>= 1.6.dfsg.2), libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.30), libnss3 (>= 3.26), libpango-1.0-0 (>= 1.14.0), libx11-6, libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.4.4-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxkbcommon0 (>= 0.5.0), libxkbfile1 (>= 1:1.1.0), libxrandr2, xdg-utils (>= 1.0.2) Recommends: libvulkan1 Conflicts: visual-studio-code Replaces: visual-studio-code Homepage: https://code.visualstudio.com/ Download-Size: 101 MB APT-Manual-Installed: yes APT-Sources: https://packages.microsoft.com/repos/code stable/main amd64 Packages Description: Code editing. Redefined. Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
and the time command from Debian:
$ apt info time Package: time Version: 1.9-0.2 Priority: optional Section: utils Maintainer: Bob Proulx <bob@proulx.com> Installed-Size: 132 kB Depends: libc6 (>= 2.34) Homepage: https://www.gnu.org/software/time Tag: devel::profiler, implemented-in::c, interface::commandline, role::program, scope::utility, suite::gnu, use::measuring, use::monitor, use::timekeeping, works-with::software:running Download-Size: 50.8 kB APT-Manual-Installed: yes APT-Sources: https://deb.debian.org/debian bookworm/main amd64 Packages Description: GNU time program for measuring CPU resource usage The 'time' command runs another program, then displays information about the resources used by that program, collected by the system while the program was running. You can select which information is reported and the format in which it is shown, or have 'time' save the information in a file instead of display it on the screen. . The resources that 'time' can report on fall into the general categories of time, memory, I/O, and IPC calls. . The GNU version can format the output in arbitrary ways by using a printf-style format string to include various resource measurements.
Figure out to which package and its version to rollback
You have to check /var/log/apt to what and when problematic 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
I assume the version 1.9-0.2 of time package is problematic and version 1.9-0.1 is fine, to demonstrate steps. You must replace the version and package with your case.
Uninstall the problematic package
After figured out, 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 login with graphical environment.
Find the applicable version of the package
You may use snapshot server (https://snapshot.debian.org/) to find appropriate snapshot date if it's from Debian. For third-party package, you may have older version in your local cache or their server, but that's not always true. Please contact the repository administrator or their manual if there's none.
Go to https://snapshot.debian.org/binary/time/ , and find it: in this case, https://snapshot.debian.org/package/time/1.9-0.1/#time_1.9-0.1
You must choose architecture same as your machine, otherwise it will not work. However most user do not have to care that.
Click /pool/main/t/time.
Setup snapshot repository
We can use Debian's snapshot repository as package is coming from Debian.
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:
# if your problematic package refers contrib, non-free, or non-free-firmware, please doing so deb https://snapshot.debian.org/archive/debian/20221008T025242Z/ main # contrib non-free non-free-firmware
comment out:
deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
and save it.
obtain older package
As usual, type apt update to obtain older package.
install older package
Type apt install time=1.9-0.1. time=1.9-0.1 requires installing with exact verison. You may encounter with broken dependency error; it may requires additional steps.
Pin the packages to prevent upgrade
Type apt-mark hold time to prevent to be upgraded by apt upgrade (or similar).
Make bug report about the regression
File 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