How to Downgrade a Package in Debian 12 Bookworm System
Categories:
3 minute read
Downgrading a package in Debian 12 (Bookworm) is sometimes necessary when a new update causes instability, compatibility issues, or unwanted changes. Unlike some rolling-release distributions, Debian maintains a stable package repository, making downgrading less common but still possible. In this guide, we’ll cover various methods to downgrade a package safely in Debian 12.
Understanding Package Downgrades in Debian
Debian uses the Advanced Package Tool (APT) for package management, which typically installs the latest available version of a package from configured repositories. However, in cases where an upgrade introduces issues, users may need to revert to an earlier version. Downgrading can be done using older repositories, manually installed .deb
files, or by using snapshot archives of Debian repositories.
Checking Installed Package Versions
Before downgrading, check the currently installed package version and available versions in the repositories.
apt list --installed | grep <package-name>
To see all available versions:
apt-cache policy <package-name>
This command displays the installed version, candidate version, and versions available in different repositories.
Method 1: Downgrade Using APT (If Older Version is in Repository)
If an older version of the package is still in the Debian repositories, you can downgrade it using APT.
Step 1: Find Available Versions
Run the following command to check available versions:
apt-cache madison <package-name>
This will show output similar to:
<package-name> | 1.5.2 | http://deb.debian.org/debian bookworm/main amd64 Packages
<package-name> | 1.4.9 | http://deb.debian.org/debian bookworm/main amd64 Packages
Step 2: Install the Older Version
To install a specific older version, run:
sudo apt install <package-name>=<version-number>
Example:
sudo apt install package-name=1.4.9
Step 3: Prevent Future Updates (Optional)
To prevent the package from being updated again, hold the package using:
sudo apt-mark hold <package-name>
To remove the hold later:
sudo apt-mark unhold <package-name>
Method 2: Using Debian Snapshot Repository
If the version you need is no longer in the standard Debian repositories, you can use Debian Snapshots, which archive older package versions.
Step 1: Find the Package Version
Go to
Debian Snapshot and search for the package. Find the URL of the .deb
file for the version you want.
Step 2: Download and Install the Package
Use wget
to download the .deb
package:
wget http://snapshot.debian.org/archive/debian/<timestamp>/pool/main/p/package-name/package-name_<version>_amd64.deb
Install the package using:
sudo dpkg -i package-name_<version>_amd64.deb
If dependencies are missing, fix them with:
sudo apt-get install -f
Method 3: Manually Install an Older .deb
Package
If you have access to an older .deb
package, you can install it manually.
Step 1: Find and Download the .deb
File
Search for the required version on official Debian mirrors or third-party sources like packages.debian.org.
Step 2: Install the .deb
File
Use dpkg
to install it:
sudo dpkg -i <package-name>.deb
Step 3: Fix Broken Dependencies
If you encounter dependency issues, run:
sudo apt-get install -f
Method 4: Using APT Pinning
APT pinning allows you to control package versions by specifying preferences for different repositories.
Step 1: Configure APT Preferences
Create a new file:
sudo nano /etc/apt/preferences.d/package-name
Add the following content:
Package: <package-name>
Pin: version <version-number>
Pin-Priority: 1001
Save and exit (CTRL+X
, then Y
).
Step 2: Update and Install
sudo apt update
sudo apt install <package-name>
This method forces APT to prefer the specified version.
Verifying Downgrade
After downgrading, confirm the installed version with:
dpkg -l | grep <package-name>
Conclusion
Downgrading a package in Debian 12 Bookworm is useful when an update causes issues. Whether using APT, Debian Snapshots, manually installing .deb
files, or APT pinning, each method provides a way to revert to a previous stable version. Always be cautious when downgrading, as dependencies may also need adjustments to maintain system stability.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.