# How to role back Linux OS patch.

To roll back a Linux patching update, it's important to note that the kernel cannot be directly downgraded through regular package management. This is because the kernel is typically installed as part of the OS patching process and is tightly integrated with the system. However, if you still need to downgrade the kernel version, you can achieve it by booting up from the old kernel through the GRUB menu and then removing the latest kernel. In this guide, we will explore the steps to downgrade the kernel patch.

1. Before proceeding, it is important to take a backup or snapshot of your system to ensure you can revert any changes if needed.
    
2. Check the current kernel version using the following command:
    
    `#uname -r`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684866319601/d64e4978-c93b-4383-bd54-29e58e7d69f3.png align="center")
    
3. List the yum history to identify the transaction ID of the kernel update using the following command:
    
    `#yum history list all`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684866356729/ee55bd28-30ac-4b96-a72a-d5c82b9ca2e7.png align="center")
    
4. Identify the transaction ID related to the kernel update. Note down the transaction ID number i.e. here 2.
    
5. Verify the installed kernel packages using the following command:
    
    `#rpm -qa --last | grep kernel`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684866612069/168b49f4-c9a4-4a26-8437-6601aaf08c90.png align="center")
    
6. Execute yum history undo &lt;transaction\_id&gt; to roll back the OS as here the transaction Id is 2.
    
    `#yum history undo <transaction_id>`
    
    `#yum history undo 2`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684866780532/8fb76c41-026a-46b7-8ce3-3ac44712b185.png align="center")
    
7. Reboot the system using the reboot command and verify that only 114 packages have been downgraded, but the kernel remains the same just because the kernel is installed.
    
    Execute **"rpm -qa | grep --i glibc"** to check the version of the `glibc` package which glibc package is also downgraded here.
    
    `#reboot`
    
    `#yum history list all`
    
    `#rpm -qa | grep --i glibc`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685476215897/52d073a5-c350-43cd-acf9-7c154693c913.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685477255567/f222147e-d146-42bf-a8b6-5f84d8bd9962.png align="center")
    
8. All tasks have been completed successfully, and the OS patching has been successfully downgraded. However, please note that the kernel has been installed and cannot be rolled back along with the OS patching.
    
9. It is recommended to perform a sanity check of your applications and databases by the respective teams to ensure everything is functioning properly with the rolled-back kernel version.
    

Remember to proceed with caution and take necessary precautions such as backups or snapshots before making any changes to your server.

All Done.

Thanks,

Anil Kushwaha
