DevOps by Default Blog

Yum downgrade packages

If you upgrade RPMs with yum upgrade and then later wish you hadn’t done, then it is pretty simple to downgrade them using yum downgrade.

Consider our example below, upgrading systemd:

[vagrant@localhost ~]$ sudo yum upgrade systemd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ukfast.co.uk
 * extras: repo.bigstepcloud.com
 * updates: www.mirrorservice.org
Resolving Dependencies
--> Running transaction check
---> Package systemd.x86_64 0:219-19.el7_2.7 will be updated
--> Processing Dependency: systemd = 219-19.el7_2.7 for package: systemd-sysv-219-19.el7_2.7.x86_64
---> Package systemd.x86_64 0:219-19.el7_2.12 will be an update
--> Processing Dependency: systemd-libs = 219-19.el7_2.12 for package: systemd-219-19.el7_2.12.x86_64
--> Running transaction check
---> Package systemd-libs.x86_64 0:219-19.el7_2.7 will be updated
--> Processing Dependency: systemd-libs = 219-19.el7_2.7 for package: libgudev1-219-19.el7_2.7.x86_64
---> Package systemd-libs.x86_64 0:219-19.el7_2.12 will be an update
---> Package systemd-sysv.x86_64 0:219-19.el7_2.7 will be updated
---> Package systemd-sysv.x86_64 0:219-19.el7_2.12 will be an update
--> Running transaction check
---> Package libgudev1.x86_64 0:219-19.el7_2.7 will be updated
---> Package libgudev1.x86_64 0:219-19.el7_2.12 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================
 Package                                     Arch                                  Version                                           Repository                              Size
==================================================================================================================================================================================
Updating:
 systemd                                     x86_64                                219-19.el7_2.12                                   updates                                5.1 M
Updating for dependencies:
 libgudev1                                   x86_64                                219-19.el7_2.12                                   updates                                 66 k
 systemd-libs                                x86_64                                219-19.el7_2.12                                   updates                                358 k
 systemd-sysv                                x86_64                                219-19.el7_2.12                                   updates                                 53 k

Transaction Summary
==================================================================================================================================================================================
Upgrade  1 Package (+3 Dependent packages)

Total download size: 5.6 M
Is this ok [y/d/N]: y
Downloading packages:
updates/7/x86_64/prestodelta                                                                                                                               | 698 kB  00:00:03
warning: /var/cache/yum/x86_64/7/updates/packages/libgudev1-219-19.el7_2.12.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for libgudev1-219-19.el7_2.12.x86_64.rpm is not installed
(1/4): libgudev1-219-19.el7_2.12.x86_64.rpm                                                                                                                |  66 kB  00:00:00
(2/4): systemd-sysv-219-19.el7_2.12.x86_64.rpm                                                                                                             |  53 kB  00:00:00
(3/4): systemd-libs-219-19.el7_2.12.x86_64.rpm                                                                                                             | 358 kB  00:00:04
(4/4): systemd-219-19.el7_2.12.x86_64.rpm                                                                                                                  | 5.1 MB  00:00:04
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                             1.1 MB/s | 5.6 MB  00:00:04
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : systemd-libs-219-19.el7_2.12.x86_64                                                                                                                            1/8
  Updating   : systemd-219-19.el7_2.12.x86_64                                                                                                                                 2/8
  Updating   : systemd-sysv-219-19.el7_2.12.x86_64                                                                                                                            3/8
  Updating   : libgudev1-219-19.el7_2.12.x86_64                                                                                                                               4/8
  Cleanup    : systemd-sysv-219-19.el7_2.7.x86_64                                                                                                                             5/8
  Cleanup    : systemd-219-19.el7_2.7.x86_64                                                                                                                                  6/8
  Cleanup    : libgudev1-219-19.el7_2.7.x86_64                                                                                                                                7/8
  Cleanup    : systemd-libs-219-19.el7_2.7.x86_64                                                                                                                             8/8
  Verifying  : systemd-sysv-219-19.el7_2.12.x86_64                                                                                                                            1/8
  Verifying  : systemd-libs-219-19.el7_2.12.x86_64                                                                                                                            2/8
  Verifying  : systemd-219-19.el7_2.12.x86_64                                                                                                                                 3/8
  Verifying  : libgudev1-219-19.el7_2.12.x86_64                                                                                                                               4/8
  Verifying  : systemd-libs-219-19.el7_2.7.x86_64                                                                                                                             5/8
  Verifying  : systemd-sysv-219-19.el7_2.7.x86_64                                                                                                                             6/8
  Verifying  : systemd-219-19.el7_2.7.x86_64                                                                                                                                  7/8
  Verifying  : libgudev1-219-19.el7_2.7.x86_64                                                                                                                                8/8

Updated:
  systemd.x86_64 0:219-19.el7_2.12

Dependency Updated:
  libgudev1.x86_64 0:219-19.el7_2.12                       systemd-libs.x86_64 0:219-19.el7_2.12                       systemd-sysv.x86_64 0:219-19.el7_2.12

Complete!
[vagrant@localhost ~]$

So at this stage our upgrade was completed successfully, however, lets assume we found an issue with the new version of the packages and would like to downgrade them.

[vagrant@localhost ~]$ sudo yum downgrade systemd libgudev1 systemd-libs systemd-sysv
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ukfast.co.uk
 * extras: repo.bigstepcloud.com
 * updates: www.mirrorservice.org
Resolving Dependencies
--> Running transaction check
---> Package libgudev1.x86_64 0:219-19.el7_2.11 will be a downgrade
---> Package libgudev1.x86_64 0:219-19.el7_2.12 will be erased
---> Package systemd.x86_64 0:219-19.el7_2.11 will be a downgrade
---> Package systemd.x86_64 0:219-19.el7_2.12 will be erased
---> Package systemd-libs.x86_64 0:219-19.el7_2.11 will be a downgrade
---> Package systemd-libs.x86_64 0:219-19.el7_2.12 will be erased
---> Package systemd-sysv.x86_64 0:219-19.el7_2.11 will be a downgrade
---> Package systemd-sysv.x86_64 0:219-19.el7_2.12 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================
 Package                                     Arch                                  Version                                           Repository                              Size
==================================================================================================================================================================================
Downgrading:
 libgudev1                                   x86_64                                219-19.el7_2.11                                   updates                                 66 k
 systemd                                     x86_64                                219-19.el7_2.11                                   updates                                5.1 M
 systemd-libs                                x86_64                                219-19.el7_2.11                                   updates                                358 k
 systemd-sysv                                x86_64                                219-19.el7_2.11                                   updates                                 53 k

Transaction Summary
==================================================================================================================================================================================
Downgrade  4 Packages

Total download size: 5.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): systemd-sysv-219-19.el7_2.11.x86_64.rpm                                                                                                             |  53 kB  00:00:00
(2/4): libgudev1-219-19.el7_2.11.x86_64.rpm                                                                                                                |  66 kB  00:00:00
(3/4): systemd-libs-219-19.el7_2.11.x86_64.rpm                                                                                                             | 358 kB  00:00:00
(4/4): systemd-219-19.el7_2.11.x86_64.rpm                                                                                                                  | 5.1 MB  00:00:02
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                             2.2 MB/s | 5.6 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : systemd-libs-219-19.el7_2.11.x86_64                                                                                                                            1/8
  Installing : systemd-219-19.el7_2.11.x86_64                                                                                                                                 2/8
  Installing : systemd-sysv-219-19.el7_2.11.x86_64                                                                                                                            3/8
  Installing : libgudev1-219-19.el7_2.11.x86_64                                                                                                                               4/8
  Cleanup    : systemd-sysv-219-19.el7_2.12.x86_64                                                                                                                            5/8
  Cleanup    : systemd-219-19.el7_2.12.x86_64                                                                                                                                 6/8
  Cleanup    : libgudev1-219-19.el7_2.12.x86_64                                                                                                                               7/8
  Cleanup    : systemd-libs-219-19.el7_2.12.x86_64                                                                                                                            8/8
  Verifying  : systemd-219-19.el7_2.11.x86_64                                                                                                                                 1/8
  Verifying  : libgudev1-219-19.el7_2.11.x86_64                                                                                                                               2/8
  Verifying  : systemd-libs-219-19.el7_2.11.x86_64                                                                                                                            3/8
  Verifying  : systemd-sysv-219-19.el7_2.11.x86_64                                                                                                                            4/8
  Verifying  : systemd-libs-219-19.el7_2.12.x86_64                                                                                                                            5/8
  Verifying  : systemd-sysv-219-19.el7_2.12.x86_64                                                                                                                            6/8
  Verifying  : systemd-219-19.el7_2.12.x86_64                                                                                                                                 7/8
  Verifying  : libgudev1-219-19.el7_2.12.x86_64                                                                                                                               8/8

Removed:
  libgudev1.x86_64 0:219-19.el7_2.12         systemd.x86_64 0:219-19.el7_2.12         systemd-libs.x86_64 0:219-19.el7_2.12         systemd-sysv.x86_64 0:219-19.el7_2.12

Installed:
  libgudev1.x86_64 0:219-19.el7_2.11         systemd.x86_64 0:219-19.el7_2.11         systemd-libs.x86_64 0:219-19.el7_2.11         systemd-sysv.x86_64 0:219-19.el7_2.11

Complete!
[vagrant@localhost ~]$

As you can see, yum reinstated the previous version without any problems.


Comments