Page 1 of 1

Linux package downgrade

Posted: Thu Sep 12, 2019 6:34 pm
by cah
Most people how to update packages using 'yum -y update <pkg>'. However, not many people actually tried to downgrade/roll back to previous version.

For RHEL 5, one needs to specify all the packages (including dependencies) in the command line such as:

Code: Select all

[root@host ~]# yum downgrade httpd-2.2.3-22.el5 httpd-manual-2.2.3-22.el5 mod_ssl-2.2.3-22.el5

Dependencies Resolved

========================================================================================================================
 Package                     Arch                Version                        Repository                         Size
========================================================================================================================
Installing:
 httpd                       i386                2.2.3-22.el5                   rhel-i386-server-5                1.2 M
 httpd-manual                i386                2.2.3-22.el5                   rhel-i386-server-5                833 k
 mod_ssl                     i386                1:2.2.3-22.el5                 rhel-i386-server-5                 87 k
Removing:
 httpd                       i386                2.2.3-31.el5                   installed                         3.1 M
 httpd-manual                i386                2.2.3-31.el5                   installed                         3.4 M
 mod_ssl                     i386                1:2.2.3-31.el5                 installed                         173 k

Transaction Summary
========================================================================================================================
Install      3 Package(s)         
Update       0 Package(s)         
Remove       3 Package(s)   

Total download size: 2.1 M
Is this ok [y/N]:
For RHEL 6 and 7, yum stores a sqlite database of information about each transaction. The history is organized terms of transaction ids and is updated every time a yum transaction affects the package configuration of the system. Mostly this database can be found in the /var/lib/yum/history/ directory.

Code: Select all

# yum history list systemd
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    10 | Chang-An Hsiao <hsiaoc1> | 2019-09-12 22:05 | Update         |    7   
     3 | root <root>              | 2019-06-05 17:09 | I, O, U        | 1107 EE
     1 | System <unset>           | 2019-05-21 16:52 | Install        | 2406   
history list
Checking the update information on ID 10 shows systemd was updated from 219-62.el7_6.5.x86_64 to 219-67.el7_7.1.x86_64:

Code: Select all

# yum history info 10     
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
Transaction ID : 10
Begin time     : Thu Sep 12 22:05:15 2019
Begin rpmdb    : 2429:06be8f62fc024aad7d6f406fcff037eef8a2d2c0
End time       :            22:05:27 2019 (12 seconds)
End rpmdb      : 2429:eb4bc8e8fb656423056fa6bfc180365c2cc965be
User           : Chang-An Hsiao <hsiaoc1>
Return-Code    : Success
Command Line   : -y update systemd
Transaction performed with:
    Installed     rpm-4.11.3-35.el7.x86_64                    @rhel-7-server-rpms
    Installed     subscription-manager-1.21.10-3.el7_6.x86_64 @rhel-7-server-rpms
    Installed     yum-3.4.3-161.el7.noarch                    @rhel-7-server-rpms
    Installed     yum-metadata-parser-1.1.4-10.el7.x86_64     @anaconda/7.5
Packages Altered:
    Updated libgudev1-219-62.el7_6.5.x86_64       @rhel-7-server-rpms
    Update            219-67.el7_7.1.x86_64       @rhel-7-server-rpms
    Updated libgudev1-devel-219-62.el7_6.5.x86_64 @rhel-7-server-rpms
    Update                  219-67.el7_7.1.x86_64 @rhel-7-server-rpms
    Updated systemd-219-62.el7_6.5.x86_64         @rhel-7-server-rpms
    Update          219-67.el7_7.1.x86_64         @rhel-7-server-rpms
    Updated systemd-devel-219-62.el7_6.5.x86_64   @rhel-7-server-rpms
    Update                219-67.el7_7.1.x86_64   @rhel-7-server-rpms
    Updated systemd-libs-219-62.el7_6.5.x86_64    @rhel-7-server-rpms
    Update               219-67.el7_7.1.x86_64    @rhel-7-server-rpms
    Updated systemd-python-219-62.el7_6.5.x86_64  @rhel-7-server-rpms
    Update                 219-67.el7_7.1.x86_64  @rhel-7-server-rpms
    Updated systemd-sysv-219-62.el7_6.5.x86_64    @rhel-7-server-rpms
    Update               219-67.el7_7.1.x86_64    @rhel-7-server-rpms
history info
We can downgrade from 7.1 to 6.5 by the following undo command:

Code: Select all

# yum history undo 10
and it will roll back to 6.5.