Skip to main content

Change default grub boot kernel – CentOS/RHEL/OEL 7

How to modify the GRUB2 default entry to boot a different Kernel version?


1. Check the current running Kernel Version
# uname -a
Linux geeklab 3.8.13-94.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux

2. List the Kernel Entries as per GRUB2 file:

# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
Oracle Linux Server, with Unbreakable Enterprise Kernel 3.8.13-94.el7uek.x86_64
Oracle Linux Server, with Unbreakable Enterprise Kernel 3.8.13-94.el7uek.x86_64 with debugging
Oracle Linux Server 7.1, with Linux 3.10.0-229.el7.x86_64
Oracle Linux Server 7.1, with Unbreakable Enterprise Kernel 3.8.13-55.1.6.el7uek.x86_64
Oracle Linux Server 7.1, with Linux 0-rescue-441e86c9ff854310a306bd33e56aae2b

NOTE: The first entry is denoted as Zero. So currently the Server is booted to 0th entry as per the above `uname -a` command output.


3. Let us modify the Kernel Version to 3.8.13-55.1.6.el7uek.x86_64 which is at line number 4 but denoted as entry

# grub2-set-default 3

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

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.8.13-94.el7uek.x86_64
Found initrd image: /boot/initramfs-3.8.13-94.el7uek.x86_64.img
Found linux image: /boot/vmlinuz-3.8.13-55.1.6.el7uek.x86_64
Found initrd image: /boot/initramfs-3.8.13-55.1.6.el7uek.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-441e86c9ff854310a306bd33e56aae2b
Found initrd image: /boot/initramfs-0-rescue-441e86c9ff854310a306bd33e56aae2b.img
done

Reboot the Server and it will boot with Kernel Version 3.8.13-55.1.6.el7uek.x86_64.
# shutdown -r now

Comments

Popular posts from this blog

Unix / Linux - File Permission

We are going to  discuss in detail about file permission and access modes in Unix. File ownership is an important component of Unix that provides a secure method for storing files. Every file in Unix has the following attributes − Owner permissions   − The owner's permissions determine what actions the owner of the file can perform on the file. Group permissions   − The group's permissions determine what actions a user, who is a member of the group that a file belongs to, can perform on the file. Other (world) permissions   − The permissions for others indicate what action all other users can perform on the file. The Permission Indicators While using  ls -l  command, it displays various information related to file permission as follows − himel@himelrana.com:~$ ls -l /home/himel total 40 drwxr-xr-x 4 himel himel 4096 Feb 10 23:26 Desktop drwxr-xr-x 2 himel himel 4096 Jan 29 23:43 Documents drwxr-xr-x 2 himel himel 4096 Jun 14 2020 Downloads -rw-r--r-- 1 himel himel 0 Feb 4

What is Unix or Linux ?

  What is Unix ? The Unix operating system is a set of programs that act as a link between the computer and the user. The computer programs that allocate the system resources and coordinate all the details of the computer's internals is called the  operating system  or the  kernel . Users communicate with the kernel through a program known as the  shell . The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel. Unix was originally developed in 1969 by a group of AT&T employees Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs. There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix and BSD are a few examples. Linux is also a flavor of Unix which is freely available. Several people can use a Unix computer at the same time; hence Unix is called a multiuser system. A user can also run multiple programs at the same time; hence Unix is