Grubby tool can be used to read information and make changed to the grub.cfg file.
Listing the default kernel:
grubby --default-kernel /boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64
To find out what the index number of the default enter the following
# grubby --default-index 0
To view all the kernels enter the following command:
grubby --info=ALL # grubby --info=ALL index=0 kernel=/boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64 args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/cl-root initrd=/boot/initramfs-4.14.12-1.el7.elrepo.x86_64.img title=CentOS Linux (4.14.12-1.el7.elrepo.x86_64) 7 (Core) index=1 kernel=/boot/vmlinuz-3.10.0-693.11.6.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/cl-root initrd=/boot/initramfs-3.10.0-693.11.6.el7.x86_64.img title=CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core) index=2 kernel=/boot/vmlinuz-3.10.0-693.11.1.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/cl-root initrd=/boot/initramfs-3.10.0-693.11.1.el7.x86_64.img title=CentOS Linux (3.10.0-693.11.1.el7.x86_64) 7 (Core) index=3 kernel=/boot/vmlinuz-3.10.0-514.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8" root=/dev/mapper/cl-root initrd=/boot/initramfs-3.10.0-514.el7.x86_64.img title=CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core) index=4 kernel=/boot/vmlinuz-0-rescue-51ec8c545ba045e2a0f287692cba31a3 args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet" root=/dev/mapper/cl-root initrd=/boot/initramfs-0-rescue-51ec8c545ba045e2a0f287692cba31a3.img title=CentOS Linux (0-rescue-51ec8c545ba045e2a0f287692cba31a3) 7 (Core) index=5 non linux entry
If you want to change the default kernel on your system, enter this:
grubby --set-default /boot/<kernel-version-goes-here>
Example:
grubby --set-default /boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64
It’s really a great and useful piece of info. I am glad that you just shared this useful information with us. Please stay us up to date like this. Thank you for sharing.
LikeLike
Awesome, thanks!
LikeLike