Linux Patch Rollback Implementation

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7
At a glance
Powered by AI
The document discusses patch rollback processes for RHEL 5 and RHEL 6. It provides steps to configure rollback before patching and commands to rollback patches after they have been applied.

The steps to configure rollback for patching in RHEL 5 are: 1) Create a file /etc/rpm/macros and add lines for transaction color and repackage erasures. 2) Validate file /etc/yum.conf contains the tsflags parameter set to repackage.

The command used to rollback patches in RHEL 5 is rpm -Uhv --rollback 'date'

Patch Rollback Implementation

In case the Application or Database is not functioning properly after Patching then Rollback is
required. So to implement the Rollback of patching rollback configuration has to be performed
before implementing the patches.

Patch rollback Process for RHEL 5


Process to Implement the Rollback configuration
Step 1 Create a file /etc/rpm/macros and add the below lines.
%_transaction_color 3
%_repackage_all_erasures 1
Step 2 Validate the file /etc/yum.conf contains the below parameter
tsflags=repackage

Examples of /etc/rpm/macro and / etc/yum.conf


# cat /etc/rpm/macros
%_transaction_color 3
%_repackage_all_erasures 1
# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
tsflags=repackage
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h
# Default.

# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

Command to Rollback the patch


# rpm Uhv rollback <Date when patch was applied>

Example Command
# rpm -Uhv --rollback 'August 12'

Below is the Example for implementing a patch and rollback


process.
[root@zola2 ~]# date
(Check the date of implementation)
Fri Aug 12 09:56:34 CEST 2011
[root@zola2 ~]# rpm -qa |grep vsftpd
(Check the existing version of

patch)

vsftpd-2.0.5-16.el5_5.1

[root@zola2 ~]# yum update vsftpd

yum)

(Apply patch on the server using

Loaded plugins: rhnplugin, security


Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
---> Package vsftpd.x86_64 0:2.0.5-21.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==================================================
==================================================
==================================================
=============================

Package
Arch
Version
Repository
Size
==================================================
==================================================
==================================================
=============================
Updating:
vsftpd
x86_64
2.0.5-21.el5
rhel-x86_64-server-5
140 k
Transaction Summary
==================================================
==================================================
==================================================
=============================
Install
0 Package(s)
Upgrade
1 Package(s)
Total download size: 140 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.0.5-21.el5.x86_64.rpm
| 140 kB
00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Repackaging : vsftpd
0/2
Updating
: vsftpd
1/2
Cleanup
: vsftpd
2/2
Updated:
vsftpd.x86_64 0:2.0.5-21.el5
Complete!
[root@zola2 ~]# rpm -qa |grep vsftpd

(After patching validate the

version)

vsftpd-2.0.5-21.el5

As the patch was applied on August 12, so all the patches


which were applied on this date will be rollback now.
[root@zola2 ~]# rpm -Uhv --rollback 'August 12'

Rollback packages (+1/-1) to Fri Aug 12 09:56:59 2011 (0x4e44dccb):


Preparing...
########################################### [100%]
1:vsftpd
########################################### [ 50%]
Cleaning up repackaged packages:
Removing /var/spool/repackage/vsftpd-2.0.5-16.el5_5.1.x86_64.rpm:

[root@zola2 ~]# rpm -qa |grep vsftpd

(Check the old version patch

will be back)
vsftpd-2.0.5-16.el5_5.1

Patch rollback Process for RHEL 6


Process to Implement the Rollback configuration
RHEL 6 includes the yum history module which helps to rollback any updates done
with the yum command. With this command, you can choose an update yum issued
and remove those selected packages. Screen is the package required to yum
history.
# yum install screen
[root@localhost ~]# yum history
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
ID
| Login user
| Date and time | Action(s)
| Altered
------------------------------------------------------------------------------8 | root <root>
| 2011-10-03 14:40 | Install
| 1
7 | root <root>
| 2011-09-21 04:24 | Install
| 1 ##
6 | root <root>
| 2011-09-21 04:23 | Install
| 1 ##
5 | root <root>
| 2011-09-16 13:35 | Install
| 1
4 | root <root>
| 2011-09-16 13:33 | Erase
| 1
3 | root <root>
| 2011-09-14 14:36 | Install
| 1
2 | root <root>
| 2011-09-12 15:48 | I, U
| 80
1 | System <unset>
| 2011-09-12 14:57 | Install
| 1025

Below is the Example for implementing a patch and rollback


process.
[rprice@x200 ~]$ yum history
Loaded plugins: product-id, refresh-packagekit, rhnplugin, subscription-manager
Updating Red Hat repositories.
ID
| Login user
| Date and time | Action(s)
| Altered
------------------------------------------------------------------------------46 | Robin Price II <rprice> | 2011-07-29 15:23 | Install
| 21
45 | Robin Price II <rprice> | 2011-07-29 15:19 | Install
| 5
44 | System <unset>
| 2011-07-27 18:24 | Update
| 1
43 | Robin Price II <rprice> | 2011-07-26 17:26 | Install
| 1
42 | Robin Price II <rprice> | 2011-07-26 17:02 | Install
| 1
41 | Robin Price II <rprice> | 2011-07-25 18:31 | Update
| 10
40 | Robin Price II <rprice> | 2011-07-25 18:19 | Install
| 1
39 | System <unset>
| 2011-07-20 13:15 | Update
| 1
38 | System <unset>
| 2011-07-20 13:13 | Update
| 7
37 | Robin Price II <rprice> | 2011-07-14 14:23 | Install
| 1
36 | Robin Price II <rprice> | 2011-07-14 14:08 | I, U
| 14 <
35 | Robin Price II <rprice> | 2011-07-13 17:54 | Install
| 1>
34 | System <unset>
| 2011-07-13 16:14 | Install
| 55 EE
33 | Robin Price II <rprice> | 2011-07-12 17:56 | Install
| 1
32 | Robin Price II <rprice> | 2011-07-12 14:13 | Install
| 3
31 | Robin Price II <rprice> | 2011-07-11 13:53 | Install
| 1
30 | Robin Price II <rprice> | 2011-07-08 18:48 | Install
| 1
29 | Robin Price II <rprice> | 2011-07-07 14:09 | Install
| 1
28 | Robin Price II <rprice> | 2011-07-07 10:25 | Update
| 6
27 | Robin Price II <rprice> | 2011-07-06 11:25 | Install
| 1
history list
[rprice@x200 ~]$ yum history info 45
Loaded plugins: product-id, refresh-packagekit, rhnplugin, subscription-manager
Updating Red Hat repositories.
Transaction ID : 45
Begin time
: Fri Jul 29 15:19:57 2011
Begin rpmdb : 1487:e4e93b5c1b27dc235f8084c57e9f274266ca1f23
End time
:
15:20:19 2011 (22 seconds)
End rpmdb
: 1492:4f195f78730a0026dacc9db7afb5bb5b1c49cc27
User
: Robin Price II <rprice>
Return-Code : Success
Command Line : install audacity --enablerepo=epel
Transaction performed with:
Installed
rpm-4.8.0-16.el6.x86_64
Installed
subscription-manager-0.95.17-1.el6_1.x86_64
Installed
yum-3.2.29-17.el6.noarch
Installed
yum-metadata-parser-1.1.2-16.el6.x86_64
Packages Altered:
Install
audacity-1.3.12-0.6.beta.el6.x86_64
Dep-Install soundtouch-1.5.0-1.el6.x86_64

Dep-Install vamp-plugin-sdk-2.1-1.el6.x86_64
Dep-Install wxBase-2.8.12-1.el6.x86_64
Dep-Install wxGTK-2.8.12-1.el6.x86_64
history info
[rprice@x200 ~]$ yum history undo 45
Loaded plugins: product-id, refresh-packagekit, rhnplugin, subscription-manager
Updating Red Hat repositories.
google-talkplugin
| 951 B
00:00
rhel-src
| 951 B
00:00
Undoing transaction 45, from Fri Jul 29 15:19:57 2011
Install
audacity-1.3.12-0.6.beta.el6.x86_64
Dep-Install soundtouch-1.5.0-1.el6.x86_64
Dep-Install vamp-plugin-sdk-2.1-1.el6.x86_64
Dep-Install wxBase-2.8.12-1.el6.x86_64
Dep-Install wxGTK-2.8.12-1.el6.x86_64
Resolving Dependencies
--> Running transaction check
---> Package audacity.x86_64 0:1.3.12-0.6.beta.el6 will be erased
---> Package soundtouch.x86_64 0:1.5.0-1.el6 will be erased
---> Package vamp-plugin-sdk.x86_64 0:2.1-1.el6 will be erased
---> Package wxBase.x86_64 0:2.8.12-1.el6 will be erased
---> Package wxGTK.x86_64 0:2.8.12-1.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
==================================================
==================================================
==================================================
=========
Package
Arch
Version
Repository
Size
==================================================
==================================================
==================================================
=========
Removing:
audacity
x86_64
1.3.12-0.6.beta.el6
@epel
13 M
soundtouch
x86_64
1.5.0-1.el6
@epel
139 k
vamp-plugin-sdk
x86_64
2.1-1.el6
@epel
482 k
wxBase
x86_64
2.8.12-1.el6
@epel
1.7 M
wxGTK
x86_64
2.8.12-1.el6
@epel
11 M

Transaction Summary
==================================================
==================================================
==================================================
=========
Remove
5 Package(s)
Installed size: 27 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : audacity-1.3.12-0.6.beta.el6.x86_64
1/5
Erasing : wxGTK-2.8.12-1.el6.x86_64
2/5
Erasing : wxBase-2.8.12-1.el6.x86_64
3/5
Erasing : soundtouch-1.5.0-1.el6.x86_64
4/5
Erasing : vamp-plugin-sdk-2.1-1.el6.x86_64
5/5
duration: 2135(ms)
Installed products updated.
Removed:
audacity.x86_64 0:1.3.12-0.6.beta.el6
soundtouch.x86_64 0:1.5.0-1.el6
vamp-plugin-sdk.x86_64 0:2.1-1.el6
wxBase.x86_64 0:2.8.12-1.el6
wxGTK.x86_64 0:2.8.12-1.el6
Complete!
[rprice@x200 ~]$
Refer to the below link for more info
https://access.redhat.com/knowledge/solutions/64069
http://people.redhat.com/rprice/yum_history.txt

You might also like