Sunday, 3 July 2016

Kernel version Upgrade


1.      Collect system logs.
      Collect the following system logs before start of the Linux kernel upgrade change.
§  /etc/redhat-release
§  getconf LONG_BIT
§  uname  -a
§  /etc/modprobe.conf  ( If Red Hat 3  - /etc/modules.conf )
§  /boot/grub/grub.conf
§  /etc/lilo.conf
§  /etc/hosts
§  /etc/fstab
§  df -h
§  df –h | wc –l
§  /opt/emc/SYMCLI/V7.0.1/bin/syminq
§  ifconfig –a
§  ifconfig –a | wc -l
§  netstat –rn
§  /etc/sysconfig/network
§  lsmod
§  lspci
§  ethtool ethX (where X = 0, 1, 2, 3…)


  If the system is configured with NIC teaming / bonding then we need to take these                                 additional logs
§  cat /etc/sysconfig/network-scripts/ifcfg-bond0
§  cat /proc/net/bonding/bond0
 
2.      Download the Kernel Package.

Kernel packages are different for 32 / 64 bit OS versions. Check the bit version of the Red Hat Enterprise Linux OS deployed (32 / 64 bit) with ‘getconf LONG_BIT’. And  download the appropriate package from your yum servers or directly from redhat servers

3.        Install the Kernel package.

a.      Backup the bootloader files.

Bootloader file for GRUB - /boot/grub/grub.conf
#cp –vp /boot/grub/grub.conf /boot/grub/grub.conf.$(date +%F)

Bootloader file for LILO - /etc/lilo.conf
#cp -vp /etc/lilo.conf /etc/lilo.conf.$(date +%F)

b.      upgrade the downloaded kernel using the rpm utility.

32 bit
#rpm –Uvh <kernelrpm>

64 bit
#rpm –Uvh <kernelrpm>

The kernel will have a couple of dependent rpms as well which will need to be installed to ensure the kernel upgrade.
It is recommended that the kernel should always be upgraded & not overwritten with a new kernel install.

c.       Modify the bootloader configuration file (if required).

In case the bootloader used is LiLo - the configuration file is /etc/lilo.conf


After install of the kernel modify the “default=” line so that it points to the newly installed kernel. The default value should be equal to label value of the newly installed kernel. So modify the default value to the correct label and ensure it points to the newly installed kernel.

Once the LiLo configuration file is modified correctly, execute the below command to verify if the bootloader configuration changes was done successfully and it’s pointing to the newly installed kernel.

#lilo –t

Execute the below command to install the changes to the bootloader. The LiLo configuration file will be re-read and the changes will be written to the MBR.

#lilo –v


In case the bootloader used is GRUB the configuration file is /boot/grub/grub.conf

Verify the default= value is pointing to the newly installed kernel and if its not then we need to change as per the stanza line of the newly installed kernel (count starts from 0). First stanza is 0, second stanza is 1 etc. Save the changes made and the next time the machine boots, it will boot into the newly installed kernel by default.


4.      Reboot the server.
       #shutdown –r now


Rollback Plan

It has been observed that the kernel upgrade change results to some issues like kernel panic etc and we need to rollback the change. To rollback we boot the server from the pervious kernel.

Procedure
1.      Keep a note of what was the kernel version before change. (System logs).
2.      Reboot the server from the remote console.
3.      Watch the booting process and stop the booting when you see the bootloader page
4.      For GRUB bootloader press any keep to stop the booting process at the GRUB bootloader page.
5.      Select the previous kernel, press Enter to boot from the selected kernel.
6.      Once the system comes up with the previous kernel then make the change persistent by modify the /etc/grub.conf or copy the backed up grub.conf file so that it boots from the previous kernel automatically after every reboot.


7.      For LiLo bootloader – press ‘Ctrl+x’ to stop the booting process.
At boot: prompt double tab will list all kernel versions installed on the server
Type the previous kernel version name followed by 3 to boot in multiuser mode.
8.      Once the system boots up from the previous kernel make the changes persistent by modifying the LiLo bootloader configuration file /etc/lilo.conf or copy the backed up /etc/lilo.conf configuration file and execute below command to re-read the LiLo configuration file
#lilo -v  




No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...