Solved

Need to roll back kernel via script

Posted on 2016-09-20
4
76 Views
Last Modified: 2016-10-21
Hi all ,

Is there any way if our new kernel patch failed then I can roll back to previous via script on 100 servers as in this case we need to make sure that last good kernel need to be active no matter how many there are
0
Comment
Question by:The Rock
  • 2
  • 2
4 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 41808004
You need to update grub.conf to use the prior kernel to boot.
Usually the default will be 0, change it to 1 provided you have not deleted the old kernel.
the other option provided you have two kernels, delete the newest one.

Since you have 100, presumably you have a RedHat based linux distro?
do you have grub-set-default
do you have grubby (command/tool) that can determine which bootloader you are using .....?

did you compile and push your own kernel? I.e. missing module/driver for a device?
0
 

Author Comment

by:The Rock
ID: 41817382
Thanks for your feedback but in our enviroment we are using almost all old and new version of rhel and centos like 4,5,6,7. So i need to build a script to work on all and grubby not work on all.

Cant we do one thing like before upgrade capture the old kernel and then after upgrade capture new kernel and then accordingly user can choose from which kernel they want to boot.
something like this?
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 41817801
Make sure your yum.conf update conf to make sure an update of kernel does not remove all old ones,  I think you can set a number of prior kernel versions that remain.
Perl scripting San change the number after
Default=0
To one or two, but you have to know which kernel you want set.
I.e. You gave kernel X.y-1
Since one need not reboot after an update unless the kernel has to be patched, there could be several updates be gore a reboot such that the current X.y-1 is no longer 1 it can be 2,3 or 4 depending  on how many prior kernels you keep.
0
 

Author Closing Comment

by:The Rock
ID: 41854802
Thanks Arnold .

Got the logic
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question