grub2 tips and tricks – CentOS/RHEL based

grub2 is vastly different from grub. Will post some tips and tricks..

list the current kernels on the OS
# egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
Linux Server, with Linux 3.10.0-123.el7.x86_64
Linux Server, with Linux 3.10.0-123.4.4.el7.x86_64
Linux Server, with Linux 0-rescue-d3e0313c0f6d48a0bb72495d2x32r1

if your wanting to change the defautl kernel that the system boots into grub2-set-default # where the # is the line number starting with 0
if your just wanting to boot into a version of kernel just 1 time you can do grub2-reboot # where the # is the line number starting with 0
or if you like you can edit /etc/default/grub and set the GRUB_DEFAULT=#

To re-generate grub.cfg grub2-mkconfig -o /boot/grub2/grub.cfg

To set and use basic text mode and show all kernels by default edit /etc/default/grub and re-generate the grub.cfg

Boot options again edit /etc/default/grub and re-generate the grub.cfg
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=vglocal00/swap00 rd.lvm.lv=vglocal00/root00 net.ifnames=0 biosdevname=0 rdblacklist=bfa nomodeset"

Install grub onto a disk
grub2-install /dev/sdX where X is the disk designation

Will add more later…


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.