26 C
Texas

How To Revert OS Patching on CentOS 8 / RHEL 8

Sometimes we run updates on our system and they may break your system or application that is running on top of it. Although these occurs rarely but we will see here that how we can revert our updates. Follow the below steps to proceed towards reverting.

Step 1: Update History

You can see the history of updating all activities you have made so for with yum command including the OS Patching by running. Run with sudo.

[root@localhost sabi]# yum history
ID | Command line | Date and time | Action(s) | Altered
16 | install -y redis | 2019-12-24 06:28 | Install | 1 15 | -y install @mariadb | 2019-12-24 06:22 | Install | 10 14 | install -y nodejs nginx | 2019-12-24 06:21 | Install | 9 < 13 | install -y epel-release | 2019-12-24 06:20 | Install | 7 > 12 | -y update | 2019-12-24 05:24 | I, U | 92 EE 11 | install -y VirtualBox-6. | 2019-12-24 05:00 | Install | 35 EE 10 | -y install wget | 2019-12-24 04:23 | Upgrade | 1 9 | install -y kernel-devel | 2019-12-23 21:05 | Install | 123 8 | -y update | 2019-12-23 19:24 | I, U | 78 EE

As you can see the output above, you can see the ID of updates.

- Advertisement -

You can also find more information of the history by typing

yum history info <ID>

Output:

[root@localhost sabi]# yum history info 8
Transaction ID : 8
Begin time : Mon 23 Dec 2019 07:24:42 PM PKT
Begin rpmdb : 1325:302c06910b5035a294f72fe71b9b0411003a5791
End time : Mon 23 Dec 2019 07:30:53 PM PKT (6 minutes)
End rpmdb : 1329:2256499a1b7cbafa860a3d6291d1c09aeeca3b53
User : Sabir Hussain
Return-Code : Success
Releasever : 8
Command Line : -y update
Packages Altered:
Install grub2-tools-efi-1:2.02-66.el8_0.1.x86_64 @BaseOS
Install kernel-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Install kernel-core-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Install kernel-modules-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Upgrade bash-4.4.19-8.el8_0.x86_64 @BaseOS
Upgraded bash-4.4.19-7.el8.x86_64 @@System
Upgrade bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 @BaseOS
Upgraded bind-export-libs-32:9.11.4-16.P2.el8.x86_64 @@System
Upgrade bpftool-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Upgraded bpftool-4.18.0-80.el8.x86_64 @@System
Upgrade cockpit-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-185-2.el8.x86_64 @@System
Upgrade cockpit-bridge-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-bridge-185-2.el8.x86_64 @@System
Upgrade cockpit-system-185.1-1.el8_0.noarch @BaseOS
Upgraded cockpit-system-185-2.el8.noarch @@System
Upgrade cockpit-ws-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-ws-185-2.el8.x86_64 @@System
Upgrade device-mapper-multipath-0.7.8-7.el8_0.2.x86_64 @BaseOS
Upgraded device-mapper-multipath-0.7.8-7.el8.x86_64 @@System
Upgrade device-mapper-multipath-libs-0.7.8-7.el8_0.2.x86_64 @BaseOS
Upgraded device-mapper-multipath-libs-0.7.8-7.el8.x86_64 @@System
Upgrade dracut-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-config-rescue-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-config-rescue-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-network-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-network-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-squash-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-squash-049-10.git20190115.el8.x86_64 @@System
Upgrade grub2-common-1:2.02-66.el8_0.1.noarch @BaseOS
Upgraded grub2-common-1:2.02-66.el8.noarch @@System
Upgrade grub2-pc-1:2.02-66.el8_0.1.x86_64 @BaseOS

Similarly you can see the information about other ID’s.

Step 2: Revert Updates

After identifying the OS patching ID and Kernel updates ID (mostly updated kernel is installed along with OS patching), move forward to revert updates one by one.

Step 3: Kernel

This step will not be applicable if the Kernel was installed along with OS patching (yum update).

Type the following command to revert the history followed by ID. Press Y to Continue.

yum history undo <ID>

Output:

[root@localhost sabi]# yum history undo 8
Last metadata expiration check: 0:01:19 ago on Wed 25 Dec 2019 12:47:38 PM PKT.
Undoing transaction 8, from Mon 23 Dec 2019 07:24:42 PM PKT
Install grub2-tools-efi-1:2.02-66.el8_0.1.x86_64 @BaseOS
Install kernel-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Install kernel-core-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Install kernel-modules-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Upgrade bash-4.4.19-8.el8_0.x86_64 @BaseOS
Upgraded bash-4.4.19-7.el8.x86_64 @@System
Upgrade bind-export-libs-32:9.11.4-17.P2.el8_0.1.x86_64 @BaseOS
Upgraded bind-export-libs-32:9.11.4-16.P2.el8.x86_64 @@System
Upgrade bpftool-4.18.0-80.11.2.el8_0.x86_64 @BaseOS
Upgraded bpftool-4.18.0-80.el8.x86_64 @@System
Upgrade cockpit-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-185-2.el8.x86_64 @@System
Upgrade cockpit-bridge-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-bridge-185-2.el8.x86_64 @@System
Upgrade cockpit-system-185.1-1.el8_0.noarch @BaseOS
Upgraded cockpit-system-185-2.el8.noarch @@System
Upgrade cockpit-ws-185.1-1.el8_0.x86_64 @BaseOS
Upgraded cockpit-ws-185-2.el8.x86_64 @@System
Upgrade device-mapper-multipath-0.7.8-7.el8_0.2.x86_64 @BaseOS
Upgraded device-mapper-multipath-0.7.8-7.el8.x86_64 @@System
Upgrade device-mapper-multipath-libs-0.7.8-7.el8_0.2.x86_64 @BaseOS
Upgraded device-mapper-multipath-libs-0.7.8-7.el8.x86_64 @@System
Upgrade dracut-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-config-rescue-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-config-rescue-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-network-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-network-049-10.git20190115.el8.x86_64 @@System
Upgrade dracut-squash-049-10.git20190115.el8_0.1.x86_64 @BaseOS
Upgraded dracut-squash-049-10.git20190115.el8.x86_64 @@System
Upgrade grub2-common-1:2.02-66.el8_0.1.noarch @BaseOS
Upgraded grub2-common-1:2.02-66.el8.noarch @@System
Upgrade grub2-pc-1:2.02-66.el8_0.1.x86_64 @BaseOS
Upgraded grub2-pc-1:2.02-66.el8.x86_64 @@System
Upgrade grub2-pc-modules-1:2.02-66.el8_0.1.noarch @BaseOS

Step 4: Revert Packages

Run the yum history undo with ID to revert the activities (revert OS updates)

[root@localhost sabi]# yum history undo 6
Last metadata expiration check: 0:04:21 ago on Wed 25 Dec 2019 12:47:38 PM PKT.
Undoing transaction 6, from Sun 22 Dec 2019 02:17:13 PM PKT
Install ipvsadm-1.29-8.el8.x86_64 @AppStream
Dependencies resolved.
Package Arch Version Repository Size
Removing:
ipvsadm x86_64 1.29-8.el8 @AppStream 83 k
Transaction Summary
Remove 1 Package
Freed space: 83 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: ipvsadm-1.29-8.el8.x86_64 1/1
Erasing : ipvsadm-1.29-8.el8.x86_64 1/1
Running scriptlet: ipvsadm-1.29-8.el8.x86_64 1/1
Verifying : ipvsadm-1.29-8.el8.x86_64 1/1
Removed:
ipvsadm-1.29-8.el8.x86_64
Complete!

After it, reboot system by

reboot

Step 5: Verifying Revert Process

Kernel

Type the given command to verify the revert process of kernel

uname -a

Output:

[root@localhost sabi]# uname -a
Linux localhost.localdomain 4.18.0-80.11.2.el8_0.x86_64 #1 SMP Tue Sep 24 11:32:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Packages

Run the below command to verify the revert process of Packages by comparing new and downgraded version.

rpm -qa <package name>

So, that is it. Please share our posts and join our Telegram Channel

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article