Skip to main content
  1. Posts/

How to Rollback Packages on Linux

·2453 words·12 mins
Linux Blog tutorial guide terminal console
Why Rollback Packages on Linux?>

Why Rollback Packages on Linux? #

Rolling back packages on Linux can be a lifesaver when something goes wrong after a software update. Linux systems are known for their reliability, but even the most stable software can have bugs or conflicts that cause unexpected issues. In such cases, rolling back to a previous version of the software can be the easiest and most effective fix.

But what exactly does it mean to “rollback” a package? In the simplest terms, it means reverting to a previous version of a software package that was installed on your Linux system. This can be done using package management tools such as apt, dpkg, or yum, depending on your Linux distribution.

There are several reasons why you may want to rollback a package:

Compatibility issues>

Compatibility issues #

Compatibility issues are one of the most common reasons why you may want to rollback a package. If you have installed a new version of a package and it’s causing issues with other software on your system, rolling back to an earlier version can fix the problem. For example, if a new version of a driver is causing issues with your graphics card, you can roll back to the previous version to restore functionality.

Bugs or performance issues>

Bugs or performance issues #

Another reason to rollback a package is if you are experiencing issues with the software itself. New updates can introduce bugs or performance issues that were not present in the previous version. In such cases, rolling back to the previous version can restore stability and performance.

Security issues>

Security issues #

Occasionally, new updates may introduce security vulnerabilities that were not present in the previous version. If you become aware of a security issue with a package you have installed, rolling back to a previous version can temporarily mitigate the vulnerability until a more permanent solution is available.

How to Rollback Packages on Linux>

How to Rollback Packages on Linux #

Now that we’ve covered why you may want to rollback a package, let’s look at how to actually do it. The process will vary slightly depending on your Linux distribution, but the basic steps are the same.

Using apt:

sudo apt-get install <package_name>=<version_number>

Using dpkg:

sudo dpkg --install /var/cache/apt/archives/<package_name>_<version_number>.deb

Using yum:

sudo yum downgrade <package_name>-<version_number>

These commands will install the specified version of the package and remove the newer version. Note that rolling back a package may also require rolling back any dependencies that were updated along with it.

In conclusion, rolling back packages on Linux can be a valuable tool when troubleshooting issues with software updates. By understanding how and when to use this technique, you can ensure that your Linux system remains stable, secure, and up-to-date.

Youtube Video:>

Youtube Video: #

How to Check Package Versions on Linux>

How to Check Package Versions on Linux #

One of the most important aspects of maintaining a Linux system is keeping track of the installed software packages and their versions. Whether you’re a system administrator or a regular user, knowing how to check package versions on Linux is crucial for troubleshooting, upgrading, or downgrading your system.

In this guide, we’ll walk you through the different ways to check package versions on Linux, including using native package managers, third-party tools, and command-line utilities.

Using Package Managers>

Using Package Managers #

The most common way to check package versions on Linux is by using the native package manager for your distribution. Package managers are essential tools that allow you to install, remove, and update software packages in a streamlined and automated way.

Debian/Ubuntu and Derivatives>

Debian/Ubuntu and Derivatives #

If you’re using Debian, Ubuntu, or any of their derivatives (e.g., Linux Mint, Pop!_OS), you can use the following command to list all installed packages with their versions:

dpkg -l

This will show you a comprehensive list of all packages installed on your system, along with their version numbers, descriptions, and status.

If you want to check the version number of a specific package, simply use the following command:

dpkg -s <package-name> | grep Version

This will display the version number of the specified package.

Red Hat/Fedora and Derivatives>

Red Hat/Fedora and Derivatives #

If you’re using Red Hat, Fedora, or any of their derivatives (e.g., CentOS, Rocky Linux), you can use the following command to list all installed packages with their versions:

rpm -qa

This will show you a list of all packages installed on your system, along with their version numbers and architecture.

If you want to check the version number of a specific package, simply use the following command:

rpm -qi <package-name> | grep Version

This will display the version number of the specified package.

Arch Linux and Derivatives>

Arch Linux and Derivatives #

If you’re using Arch Linux or any of its derivatives (e.g., Manjaro, EndeavourOS), you can use the following command to list all installed packages with their versions:

pacman -Q

This will show you a list of all packages installed on your system, along with their version numbers and installation date.

If you want to check the version number of a specific package, simply use the following command:

pacman -Qi <package-name> | grep Version

This will display the version number of the specified package.

Using Third-Party Tools>

Using Third-Party Tools #

If you prefer graphical user interfaces or want more advanced features than those offered by native package managers, you can use third-party tools to check package versions on Linux.

Synaptic Package Manager>

Synaptic Package Manager #

Synaptic is a graphical package manager for Debian-based systems that allows you to browse, install, remove, and upgrade software packages. It also provides detailed information about each package, including its version number, dependencies, and changelog.

To install Synaptic, use the following command:

sudo apt-get install synaptic

Once installed, launch Synaptic from the Applications menu and search for the package you want to check. The version number will be displayed in the Package Properties window.

Discover>

Discover #

Discover is a graphical package manager for KDE-based systems that provides a user-friendly interface to manage software packages. It allows you to search, install, remove, and update packages, as well as view package details, ratings, and reviews.

To install Discover, use the following command:

sudo apt-get install plasma-discover

Once installed, launch Discover from the Applications menu and search for the package you want to check. The version number will be displayed in the Package Details window.

Gnome Software>

Gnome Software #

Gnome Software is a graphical package manager for Gnome-based systems that allows you to browse, install, remove, and update software packages. It also provides recommendations, ratings, and reviews for each package, as well as detailed information about its dependencies and changelog.

To install Gnome Software, use the following command:

sudo apt-get install gnome-software

Once installed, launch Gnome Software from the Applications menu and search for the package you want to check. The version number will be displayed in the Package Details window.

Using Command-Line Utilities>

Using Command-Line Utilities #

If you prefer command-line utilities or want to automate the process of checking package versions on Linux, you can use a variety of tools that provide detailed information about installed packages.

apt-cache>

apt-cache #

The apt-cache utility is a command-line tool for Debian-based systems that allows you to search, show, and manipulate package information from the APT cache.

To list all installed packages with their versions, use the following command:

apt-cache policy

This will show you a list of all packages installed on your system, along with their version numbers, repository locations, and priority levels.

If you want to check the version number of a specific package, simply use the following command:

apt-cache show <package-name> | grep Version

This will display the version number of the specified package.

yum>

yum #

The yum utility is a command-line tool for Red Hat-based systems that allows you to search, install, remove, and update software packages from the Yum repository.

To list all installed packages with their versions, use the following command:

yum list installed

This will show you a list of all packages installed on your system, along with their version numbers and repository locations.

If you want to check the version number of a specific package, simply use the following command:

yum info <package-name> | grep Version

This will display the version number of the specified package.

pacman>

pacman #

The pacman utility is a command-line tool for Arch-based systems that allows you to search, install, remove, and update software packages from the Pacman repository.

To list all installed packages with their versions, use the following command:

pacman -Q

This will show you a list of all packages installed on your system, along with their version numbers and installation date.

If you want to check the version number of a specific package, simply use the following command:

pacman -Qi <package-name> | grep Version

This will display the version number of the specified package.

Conclusion>

Conclusion #

Knowing how to check package versions on Linux is an essential skill for anyone who uses the platform. Whether you prefer native package managers, third-party tools, or command-line utilities, there are plenty of ways to get detailed information about the software packages installed on your system.

By following the tips and tricks outlined in this guide, you’ll be able to troubleshoot issues, upgrade or downgrade your software, and stay up-to-date with the latest package versions. Happy package hunting!

Rollback Packages on Linux: A Comprehensive Guide - Rollback Packages on Linux with YUM>

Rollback Packages on Linux: A Comprehensive Guide - Rollback Packages on Linux with YUM #

As a Linux user, you might have encountered issues with a package update that ended up breaking your system. In such cases, it becomes necessary to rollback packages to a previous version. In this guide, we will explore how to rollback packages on Linux with YUM.

YUM is a package manager used in Red Hat-based Linux distributions like CentOS, Fedora, and RHEL. It is used to install, update, and remove packages from your system. YUM has a built-in feature that allows you to rollback packages to a previous version.

Checking Package History>

Checking Package History #

Before rolling back packages, it’s important to check the package history to identify the package that needs to be rolled back. You can use the following command to check the history of the installed packages:

yum history

This command will display a list of transactions with their respective ID, date, and description. The ID represents a unique identifier for each transaction.

Rolling Back Packages>

Rolling Back Packages #

Once you have identified the package to be rolled back, you can use the following command to roll back the package:

yum history undo <transaction-id>

Replace <transaction-id> with the ID of the transaction you want to undo. This command will revert the package to the previous version installed during that transaction.

Verifying Package Rollback>

Verifying Package Rollback #

To verify if the package has been successfully rolled back, you can use the following command:

yum list installed <package-name>

Replace <package-name> with the name of the package you want to verify. This command will display the package version currently installed on your system.

Conclusion>

Conclusion #

Rolling back packages on Linux with YUM can save you a lot of time and effort in case of a broken system due to a package update. In this guide, we have discussed how to check the package history, rollback packages, and verify the package rollback. Use these commands wisely and carefully, and you can easily maintain a stable and reliable system.

Rollback Packages on Linux: A Comprehensive Guide - Rollback Packages on Linux with APT>

Rollback Packages on Linux: A Comprehensive Guide - Rollback Packages on Linux with APT #

Linux has been a go-to operating system for many users thanks to its stability, reliability, and security features. However, like any other software, sometimes updates can cause issues that need to be fixed. This is where rollback packages come in handy.

Rollback packages are old versions of software that can be installed in place of newer versions that are causing issues. This process is often referred to as “downgrading” and can be done on Linux with the Advanced Packaging Tool (APT).

Before we dive into the steps for rolling back packages on Linux with APT, it’s important to understand why this might be necessary. There are a few reasons why you might need to roll back a package:

  • A software update caused issues with your system or other programs.
  • The new version of the software is missing important features or has changed in a way that is not desirable.
  • The new version of the software is incompatible with other software or hardware on your system.

Now that we’ve covered the reasons why you might need to roll back a package, let’s dive into the steps for doing so with APT.

Step 1: Check Your Package Versions>

Step 1: Check Your Package Versions #

The first step in rolling back a package on Linux is to check the versions of the software you currently have installed. You can do this by using the following command:

dpkg -l | grep packagename

Replace “packagename” with the name of the software you want to roll back. This command will show you the version number of the software you currently have installed.

Step 2: Find the Version You Want to Install>

Step 2: Find the Version You Want to Install #

The next step is to find the version of the software you want to install. You can do this by searching for the package in the Ubuntu package archive or by using the following command:

apt-cache showpkg packagename

This command will show you all of the available versions of the package.

Step 3: Install the Older Version>

Step 3: Install the Older Version #

Once you’ve found the version of the software you want to install, you can install it using the following command:

sudo apt-get install packagename=versionnumber

Replace “packagename” with the name of the software you want to install and “versionnumber” with the version number of the package you want to install.

Step 4: Hold the Package>

Step 4: Hold the Package #

Finally, you’ll want to “hold” the package to prevent it from being automatically updated in the future. You can do this using the following command:

sudo apt-mark hold packagename

Replace “packagename” with the name of the software you want to hold.

Rolling back packages on Linux with APT can be a lifesaver when software updates cause issues on your system. By following these simple steps, you can easily downgrade to an older version of the software and keep your system running smoothly.