How to Change Default Kernel on Cent OS

Hi All,

Today, We are going to about how to change the default Kernel on CentOS.

What is Kernel ?

Kernel is heart of Operating System, It is low level interrupter for user and hardware.

Kernel is heart of Operating System.

GRUB2 is the most common bootloader for RHEL 7 systems. A symlink to the GRUB2 config file should be present at /etc/grub2.cfg. The post describes changing the default kernel to a old kernel.

How GRUB2 selects which kernel to boot from

This instructs GRUB 2 to load the kernel specified by the saved_entry directive in the GRUB 2 environment file, located at /boot/grub2/grubenv.

One can set another GRUB record to be the default, using the grub2-set-default command, which will update the GRUB 2 environment file. By default, the saved_entry value is set to the name of latest installed kernel of package type kernel. This is defined in /etc/sysconfig/kernel by the UPDATEDEFAULT and DEFAULTKERNEL directives.

Change default kernel

To force a system to always use a particular menu entry, use the menu entry name as the key to the GRUB_DEFAULT directive in the /etc/default/grub file. The following command will print a list of the menu entries present in GRUB2’s configuration.

This will make 3.10.0-229.el7.x86_64 as defaul kernel which was the old kernel in the system.

Verify the new default kernel

Check the below file to see the kernel which will be loaded at next boot, crosscheck the numeric value with the menuentry in the /etc/default/grub file.

Rebuild GRUB2

Changes to /etc/default/grub require rebuilding the grub.cfg file as follows:

After rebooting server, the changes will take effect.

 

About

View all posts by

Leave a Reply

Your email address will not be published. Required fields are marked *