X
    Categories: Linux

How To Perform linux kernel upgrade in 5 easy steps

Performing an linux kernel upgrade offers new features and improvements. Here is a quick way to perform Linux kernel upgrade.

Steps for Linux kernel upgrade

1. Note down current kernel version details:

[root@rhel1 kernel_pkg]# uname -r
3.10.0-327.10.1.el7.x86_64
[root@ip-172-31-9-104 kernel_pkg]#

Will suggest to take the HW and Software information of the server using cfg2html in case future needs.

2.  Download the latest kernel packages from the yum server.

Make sure your system is connected to RHN network.

[root@ip-172-31-9-104 tmp]# yum install --downloadonly --downloaddir=/tmp/kernel_pkg/ kernel
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-514.10.2.el7 will be installed
--> Processing Dependency: linux-firmware >= 20160830-49 for package: kernel-3.10.0-514.10.2.el7.x86_64
--> Running transaction check
---> Package linux-firmware.noarch 0:20160830-49.git7534e19.el7 will be installed
--> Processing Conflict: kernel-3.10.0-514.10.2.el7.x86_64 conflicts kmod < 20-9
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package kmod.x86_64 0:20-5.el7 will be updated
---> Package kmod.x86_64 0:20-9.el7 will be an update
--> Processing Conflict: kernel-3.10.0-514.10.2.el7.x86_64 conflicts xfsprogs < 4.3.0
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package xfsprogs.x86_64 0:3.2.2-2.el7 will be updated
---> Package xfsprogs.x86_64 0:4.5.0-9.el7_3 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
kernel x86_64 3.10.0-514.10.2.el7 rhui-REGION-rhel-server-releases 37 M
Updating:
kmod x86_64 20-9.el7 rhui-REGION-rhel-server-releases 115 k
xfsprogs x86_64 4.5.0-9.el7_3 rhui-REGION-rhel-server-releases 895 k
Installing for dependencies:
linux-firmware noarch 20160830-49.git7534e19.el7 rhui-REGION-rhel-server-releases 31 M

Transaction Summary
========================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Upgrade 2 Packages

Total download size: 70 M
Background downloading packages, then exiting:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): xfsprogs-4.5.0-9.el7_3.x86_64.rpm | 895 kB 00:00:01
(2/4): kmod-20-9.el7.x86_64.rpm | 115 kB 00:00:01
(3/4): linux-firmware-20160830-49.git7534e19.el7.noarch.rpm | 31 MB 00:00:02
(4/4): kernel-3.10.0-514.10.2.el7.x86_64.rpm | 37 MB 00:00:04
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 16 MB/s | 70 MB 00:00:04
exiting because "Download Only" specified

In the above command we have just downloaded the kernel packages required at the location “/tmp/kernel_pkg” by specifying the “–downloaddir=” parameter option to yum command. As per the downloaded files newer version will be “3.10.0-514.10.2.”

3. Perform the Linux kernel upgrade

Once you have successfully downloaded the latest kernel rpms. Go to that particular directory. As per RedHat please do not use -U option with an rpm command for Linux kernel upgrade since it will overwrite the currently installed kernel, which creates boot loader problems later on.

A> Go to the directory where rpms are downloaded:

[root@ip-172-31-9-104 ~]# cd /tmp/kernel_pkg/
[root@ip-172-31-9-104 kernel_pkg]# pwd
/tmp/kernel_pkg
[root@ip-172-31-9-104 kernel_pkg]# ll
total 71372
-rw-r--r--. 1 root root 39080420 Mar  2 22:44 kernel-3.10.0-514.10.2.el7.x86_64.rpm
-rw-r--r--. 1 root root   117328 Nov  6 11:09 kmod-20-9.el7.x86_64.rpm
-rw-r--r--. 1 root root 32946308 Nov  6 11:02 linux-firmware-20160830-49.git7534e19.el7.noarch.rpm
-rw-r--r--. 1 root root   916416 Jan 22 07:49 xfsprogs-4.5.0-9.el7_3.x86_64.rpm
[root@ip-172-31-9-104 kernel_pkg]#

B> Execute below command for Linux kernel upgrade and enter Y when the system asks during installation:

[root@ip-172-31-9-104 kernel_pkg]# yum localinstall *.rpm
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Examining kernel-3.10.0-514.10.2.el7.x86_64.rpm: kernel-3.10.0-514.10.2.el7.x86_64
Marking kernel-3.10.0-514.10.2.el7.x86_64.rpm as an update to kernel-3.10.0-327.10.1.el7.x86_64
Examining kmod-20-9.el7.x86_64.rpm: kmod-20-9.el7.x86_64
Marking kmod-20-9.el7.x86_64.rpm as an update to kmod-20-5.el7.x86_64
Examining linux-firmware-20160830-49.git7534e19.el7.noarch.rpm: linux-firmware-20160830-49.git7534e19.el7.noarch
Marking linux-firmware-20160830-49.git7534e19.el7.noarch.rpm to be installed
Examining xfsprogs-4.5.0-9.el7_3.x86_64.rpm: xfsprogs-4.5.0-9.el7_3.x86_64
Marking xfsprogs-4.5.0-9.el7_3.x86_64.rpm as an update to xfsprogs-3.2.2-2.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-514.10.2.el7 will be installed
---> Package kmod.x86_64 0:20-5.el7 will be updated
---> Package kmod.x86_64 0:20-9.el7 will be an update
---> Package linux-firmware.noarch 0:20160830-49.git7534e19.el7 will be installed
---> Package xfsprogs.x86_64 0:3.2.2-2.el7 will be updated
---> Package xfsprogs.x86_64 0:4.5.0-9.el7_3 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
kernel x86_64 3.10.0-514.10.2.el7 /kernel-3.10.0-514.10.2.el7.x86_64 148 M
linux-firmware noarch 20160830-49.git7534e19.el7 /linux-firmware-20160830-49.git7534e19.el7.noarch 96 M
Updating:
kmod x86_64 20-9.el7 /kmod-20-9.el7.x86_64 231 k
xfsprogs x86_64 4.5.0-9.el7_3 /xfsprogs-4.5.0-9.el7_3.x86_64 3.9 M

Transaction Summary
========================================================================================================================================================================
Install 2 Packages
Upgrade 2 Packages

Total size: 248 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : linux-firmware-20160830-49.git7534e19.el7.noarch 1/6
Updating : kmod-20-9.el7.x86_64 2/6
Installing : kernel-3.10.0-514.10.2.el7.x86_64 3/6
Updating : xfsprogs-4.5.0-9.el7_3.x86_64 4/6
Cleanup : xfsprogs-3.2.2-2.el7.x86_64 5/6
Cleanup : kmod-20-5.el7.x86_64 6/6
Verifying : kernel-3.10.0-514.10.2.el7.x86_64 1/6
Verifying : kmod-20-9.el7.x86_64 2/6
Verifying : xfsprogs-4.5.0-9.el7_3.x86_64 3/6
Verifying : linux-firmware-20160830-49.git7534e19.el7.noarch 4/6
Verifying : xfsprogs-3.2.2-2.el7.x86_64 5/6
Verifying : kmod-20-5.el7.x86_64 6/6

Installed:
kernel.x86_64 0:3.10.0-514.10.2.el7 linux-firmware.noarch 0:20160830-49.git7534e19.el7

Updated:
kmod.x86_64 0:20-9.el7 xfsprogs.x86_64 0:4.5.0-9.el7_3

Complete!

4. Check the Initial RAM Disk Image after Linux kernel upgrade

Initial RAM disk image pre-loads the block device modules, such as for IDE, SCSI and even RAID, so that the root file system, on which those modules normally reside, can then be accessed and mounted.

To verify the same goto /boot directory and make sure you have a kernel file for latest kernel vmlinuz-<version> and init ram disk image initramfs-<version> files are available.

[root@ip-172-31-9-104 ~]# ls -ltr /boot
total 201792
-rw-------. 1 root root 2963279 Jan 23 2016 System.map-3.10.0-327.10.1.el7.x86_64
-rw-r--r--. 1 root root 126431 Jan 23 2016 config-3.10.0-327.10.1.el7.x86_64
-rwxr-xr-x. 1 root root 5153184 Jan 23 2016 vmlinuz-3.10.0-327.10.1.el7.x86_64
-rw-r--r--. 1 root root 252630 Jan 23 2016 symvers-3.10.0-327.10.1.el7.x86_64.gz
-rw-------. 1 root root 15271389 Mar 1 2016 initramfs-3.10.0-327.el7.x86_64.img
-rw-r--r--. 1 root root 36255775 Mar 1 2016 initramfs-0-rescue-e8f19fd1b8f1495db0b922f17f8112eb.img
-rwxr-xr-x. 1 root root 5153184 Mar 1 2016 vmlinuz-0-rescue-e8f19fd1b8f1495db0b922f17f8112eb
-rw-r--r--. 1 root root 35778373 Mar 1 2016 initramfs-3.10.0-327.10.1.el7.x86_64.img
-rw-------. 1 root root 3112473 Feb 20 02:48 System.map-3.10.0-514.10.2.el7.x86_64
-rw-r--r--. 1 root root 137701 Feb 20 02:48 config-3.10.0-514.10.2.el7.x86_64
-rwxr-xr-x. 1 root root 5391456 Feb 20 02:48 vmlinuz-3.10.0-514.10.2.el7.x86_64
-rw-r--r--. 1 root root 277969 Feb 20 02:51 symvers-3.10.0-514.10.2.el7.x86_64.gz
-rw-r--r--. 1 root root 25643445 Mar 27 06:00 initramfs-3.10.0-327.10.1.el7.x86_64kdump.img
-rw-r--r--. 1 root root 45359571 Mar 27 07:05 initramfs-3.10.0-514.10.2.el7.x86_64.img
drwxr-xr-x. 2 root root 37 Mar 27 07:05 grub
drwx------. 6 root root 104 Mar 27 07:05 grub2
-rw-r--r--. 1 root root 25728741 Mar 27 07:26 initramfs-3.10.0-514.10.2.el7.x86_64kdump.img
[root@ip-172-31-9-104 ~]#

In the above output we have latest version files “3.10.0-514.10.2.el7” for kernel and init ram disk images as “vmlinuz-3.10.0-514.10.2.el7.x86_64” and “initramfs-3.10.0-514.10.2.el7.x86_64kdump.img” respectively.Hence we are good to go.

Also you need to check if the grub boot-loader file “/boot/grub/grub.conf” is initialized with latest version of kernel file “vmlinuz-3.10.0-514.10.2.el7.x86_64”  for the kernel parameter entry and also check the initramfs image  location is properly updated with latest version of file  “initramfs-3.10.0-514.10.2.el7.x86_64kdump.img” for initrd parameter as below:

[root@ip-172-31-9-104 ~]# cat /boot/grub/grub.conf
default=0
timeout=0

title Red Hat Enterprise Linux Server (3.10.0-514.10.2.el7.x86_64) 7.2 (Maipo)
root (hd0)
kernel /boot/vmlinuz-3.10.0-514.10.2.el7.x86_64 ro root=UUID=65722bd1-fccc-453e-a96a-8f3599aa0466 console=hvc0 LANG=en_US.UTF-8
initrd /boot/initramfs-3.10.0-514.10.2.el7.x86_64.img
title Red Hat Enterprise Linux 7 (3.10.0-327.10.1.el7.x86_64)
root (hd0)
kernel /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64 ro root=UUID=65722bd1-fccc-453e-a96a-8f3599aa0466 console=hvc0 LANG=en_US.UTF-8
initrd /boot/initramfs-3.10.0-327.10.1.el7.x86_64.img
[root@ip-172-31-9-104 ~]#

5. Reboot the server and check current version of kernel

Once All set you can reboot the server and check the upgraded version kernel with below command:

[root@ip-172-31-9-104 ~]# uname -r
3.10.0-514.10.2.el7.x86_64
[root@ip-172-31-9-104 ~]#

Our kernel version prior to installation is as below:

[root@ip-172-31-9-104 kernel_pkg]# uname -r
3.10.0-327.10.1.el7.x86_64

Which confirms that we have successfully performed linux kernel upgrade.

 

View Comments (0)

Related Post