Mar 282016
 

A typical CentOS 7 Linux system has multiple kernels.

How many kernels you have in your CentOS systems depends on the configuration setting.

Sometimes you might feel the need to change the default kernel to a different one (it may be an older or newer kernel) to ensure a particular application runs well.

Here’s how to change the default kernel at boot time.

List Available Kernels

First, let’s list the available kernels on our CentOS 7 system with the following command (you need to be root).

$ sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.4.5.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.4.4.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.3.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-229.20.1.el7.x86_64) 7 (Core)
CentOS Linux, with Linux 0-rescue-ddf73bd8a3a44950a327a6961955c015

Once you have the kernel list, you can decide which kernel you want as the default boot kernel.

Change Default Kernel

Multiple kernel boot options are available to us in the above list.

Now it’s time to set our preferred boot kernel.

Important – The boot options in the above kernel list start at 0.

So if you want the 3.10.0-229.20.1.el7.x86_64 kernel as the default kernel, note that its boot option will be 4 in the above list.

Now let’s set 3.10.0-229.20.1.el7.x86_64 as our default kernel with the sudo grub2-set-default command.

$ sudo grub2-set-default 4

After changing the default kernel, you must reboot (remember to close all your open applications).

$ sudo reboot

Once the system has come up after reboot, it’s time to check if the default kernel has changed via the uname -r command.

$ uname -r 
3.10.0-229.20.1.el7.x86_64

Voila, changing the default boot kernel in CentOS 7 is as simple as that.

Related Posts
Get Rid of Old Kernels in CentOS 7 and Red Hat 7

Sorry, the comment form is closed at this time.