Table of Contents
Downgrading a package on Ubuntu Server 24.04 can help restore a stable version when a recent update causes compatibility issues, service failures, or application errors. The process should be done carefully because older package versions may include outdated dependencies or security fixes.
On a Linux VPS server, package downgrades are useful when a production service stops working after an update and needs to be returned to a known working version.
Step 1: Connect to the Ubuntu Server
Access the server using SSH:
ssh root@your_server_ip
Step 2: Update Package Information
Refresh the local package index:
apt update
This helps Ubuntu show the latest available package versions from configured repositories.
Step 3: Check the Installed Package Version
Check the currently installed version of a package:
apt list --installed package_name
Example:
apt list --installed nginx
You can also use:
dpkg -l | grep package_name
Step 4: List Available Package Versions
Display available versions from the enabled repositories:
apt-cache policy package_name
Example:
apt-cache policy nginx
The output shows the installed version, candidate version, and older versions available from repositories.
Step 5: Downgrade to a Specific Version
Install a specific package version using this format:
apt install package_name=version_number
Example:
apt install nginx=1.24.0-2ubuntu7
Replace the version number with one shown in the apt-cache policy output.
Step 6: Allow Downgrades If Required
If APT blocks the downgrade, use:
apt install package_name=version_number --allow-downgrades
Example:
apt install nginx=1.24.0-2ubuntu7 --allow-downgrades
Use this option only when you are sure the selected version is compatible with your server.
Step 7: Verify the Downgraded Version
Check the installed package version again:
apt list --installed package_name
Example:
apt list --installed nginx
You can also verify the service version if the package provides a command-line tool:
nginx -v
Step 8: Hold the Package Version
Prevent Ubuntu from upgrading the package automatically during future updates:
apt-mark hold package_name
Example:
apt-mark hold nginx
Check held packages:
apt-mark showhold
Step 9: Unhold the Package Later
When you are ready to allow updates again, remove the hold:
apt-mark unhold package_name
Example:
apt-mark unhold nginx
Then upgrade the package normally:
apt update
apt upgrade
Step 10: Fix Dependency Issues
If the downgrade causes dependency problems, run:
apt --fix-broken install
You can also inspect package dependencies with:
apt-cache depends package_name
Dependency issues are more likely when the older version is from a different repository or release.
Step 11: Restart the Related Service
If the downgraded package runs as a service, restart it:
systemctl restart service_name
Example:
systemctl restart nginx
Check the service status:
systemctl status nginx
Downgrading a package on Ubuntu Server 24.04 can quickly restore compatibility after a problematic update. For production VPS environments, always verify available versions, test the service after downgrading, and hold the package only when there is a clear reason to prevent future upgrades.
Need a Linux Server for This?
Run Debian, Ubuntu, or any Linux distro on DropVPS โ fast NVMe SSD, full root access, and 24/7 support. Perfect for everything you just read.
- Full Root Access
- Debian & Ubuntu Ready
- 99.99% Uptime
- 24/7 Support
No commitment ยท Cancel anytime
