Solved

Need to roll back kernel via script

Posted on 2016-09-20
4
86 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How yum repo uses sqlite3 to keep metadata about the repository? 2 47
ftp to port 21 4 54
error log using ftp 7 56
Run Secure WMI query from CentOS 5 84
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

830 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