How to Downgrade Recently Updated Package Using apt Command

Encountering issues after a recent software update is not uncommon. If a newly updated package introduces unexpected bugs or errors, reverting to a previous version can often save time and effort. Fortunately, in Ubuntu and Debian-based distributions, downgrading a package is a straightforward process using the apt command.

Here’s a step-by-step guide to help you navigate through the downgrade process:

Step 1: Identify the Desired Package Version

Begin by determining the specific version of the package you wish to downgrade to. This information is crucial for executing the downgrade command effectively. You can retrieve a list of available package versions using the following command:

sudo apt-cache policy package_name

Replace “package_name” with your real name in above command.

Review the output to identify older versions of the package. If older versions are listed, you can proceed with the downgrade process.

Step 2: Execute the Downgrade Command

Once you’ve identified the desired package version, initiate the downgrade process by executing the apt command with the appropriate package version specification. Use the following syntax:

sudo apt install package_name=package-version-number

Replace package_name with the name of the package you wish to downgrade and package-version-number with the specific version you identified in Step 1.

Also Read:  How to Install Qt Design Studio Community Edition on Ubuntu

Step 3: Confirm the Downgrade

Upon executing the downgrade command, you may receive a warning regarding the package downgrade. Confirm the downgrade process by proceeding with the installation. Once completed, the package will be downgraded to the specified older version.

Preventing Future Updates

To prevent the downgraded package from being updated automatically during system updates, you can utilize the apt-mark command to hold its current version. This ensures that the package remains at the downgraded version until you decide to update it manually.

Execute the following command to hold the package:

sudo apt-mark hold package_name

Replace package_name with the name of the downgraded package. By following these steps, you can downgrade recently updated packages using the apt command in Ubuntu and Debian-based distributions, providing a solution to unexpected issues introduced by software updates.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



Leave a Reply