Change default kernel boot Centos 7
Posted on December 5, 2018 • 1 minutes • 133 words • Suggest Changes
I installed a new kernel (kernel-ml, from mainline 4.18) to make sure on next boot it got selected this is what I had to do : (Since its headless and I won’t see grub when it boots)
Install kernel mainline :
yum install kernel-ml
Find the current installed kernels :
cat /boot/grub2/grub.cfg | grep ^menuentry | cut -c1-50 | nl -v 0
for me :
0 menuentry 'CentOS Linux (4.18.16-1.el7.elrepo.x86_ 1 menuentry 'CentOS Linux (3.10.0-693.5.2.el7.x86_64 2 menuentry 'CentOS Linux (0-rescue-daa04fd470a24a8f
So I want the first kernel (starting from 0) as default; This can be added in /etc/default/grub
:
GRUB_DEFAULT=0
Then remake grub config :
grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot and the new kernel is :
[root@svennd ~]# uname -a Linux svennd.local 4.18.16-1.el7.elrepo.x86_64 #1 SMP Sat Oct 20 12:52:50 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux