Grub Menu shows kernels in wrong order

Issues related to applications and software problems and general support
Post Reply
watchingdogs
Posts: 4
Joined: 2019/10/14 20:17:16

Grub Menu shows kernels in wrong order

Post by watchingdogs » 2019/10/25 23:44:39

I'm trying to make a kernel booted by default, I usually do

Code: Select all

grubby --set-default=/boot/4.18.debug
and that does the trick.

Output from grubby --info=ALL

Code: Select all

/boot/4.18.debug
index=0
..
/boot/someotherkernel
index=1
...
/boot/another
index=2
...etc
However when my grub menu comes up when I boot the kernels are listed in a different order.
  • someotherkernel
    another
    4.18.debug
So "someotherkernel" is being booted instead of 4.18.debug. Since it's now using the new bootloader specification, how do I fix the order the grub menu is showing?
I am still able to edit default in /etc/default/grub to "2", but I want to avoid having to reboot machine to see the order of the kernels on the menu if I add more kernels in the future.

addmin
Posts: 23
Joined: 2019/05/07 10:16:11

Re: Grub Menu shows kernels in wrong order

Post by addmin » 2019/10/26 06:43:04

1.

Code: Select all

grub2-mkconfig  -o grub.cfg
grub2-install /dev/sdx
2.edit grub.cfg to the required order by interchanging the order of only menu entries which look like
menuentry 'title with options' {}
3.

Code: Select all

grub2-set-default <position>
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
For more: https://wiki.centos.org/HowTos/Grub2
Last edited by addmin on 2019/10/26 08:19:20, edited 1 time in total.

nouvo09
Posts: 146
Joined: 2009/09/19 19:21:36
Location: Paris, France

Re: Grub Menu shows kernels in wrong order

Post by nouvo09 » 2019/10/26 07:23:51

grub2-install /dev/sdax
Not relevant with the problem. Besides that sdaX <-- is not correct.
Member of centos-FR forum

addmin
Posts: 23
Joined: 2019/05/07 10:16:11

Re: Grub Menu shows kernels in wrong order

Post by addmin » 2019/10/26 08:20:06

nouvo09 wrote:
2019/10/26 07:23:51
grub2-install /dev/sdax
Not relevant with the problem. Besides that sdaX <-- is not correct.
corrected.

addmin
Posts: 23
Joined: 2019/05/07 10:16:11

Re: Grub Menu shows kernels in wrong order

Post by addmin » 2019/10/27 15:49:00

PS: The above is a solution till centos 7 and will work for centos 8 only when
the /etc/default/grub includes Boot Loader Specification (BLS) config set to false

Code: Select all

GRUB_ENABLE_BLSCFG=false
Boot Loader Specification (BLS) is a new scheme introduced in centos 8.
Bootloader inserts the blscfg module and entries placed in /boot/loader/entries/
when it encounters the following code in /boot/grub2/grub.cfg

Code: Select all

insmod blscfg
blscfg
For more on how BLS has shared boot menu items among bootloader(grub2), OS (kernel) and userspace(fstab)
refer :
https://systemd.io/BOOT_LOADER_SPECIFICATION

nouvo09
Posts: 146
Joined: 2009/09/19 19:21:36
Location: Paris, France

Re: Grub Menu shows kernels in wrong order

Post by nouvo09 » 2019/10/27 16:18:07

Curiously grub shows the entries of the menu in the same order they are in /boot/loader/entries i-e in alphabetic order !!

Code: Select all

# ls -l /boot/loader/entries
total 12
-rw-r--r--. 1 root root 325 26 oct.  08:15 f78e00f22e9d47c3814a60a9dffa8afb-0-rescue.conf
-rw-r--r--. 1 root root 273 26 oct.  08:15 f78e00f22e9d47c3814a60a9dffa8afb-5.3.7-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 379 25 août  19:08 fb0c7db0921149639d5f00295eb34d23-0-rescue.conf
-rw-r--r--. 1 root root 277  9 oct.  11:03 fb0c7db0921149639d5f00295eb34d23-5.2.18-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 273 16 oct.  07:52 fb0c7db0921149639d5f00295eb34d23-5.3.5-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 273 18 oct.  09:42 fb0c7db0921149639d5f00295eb34d23-5.3.6-200.fc30.x86_64.conf
# 
and UUID are in first place.
Member of centos-FR forum

watchingdogs
Posts: 4
Joined: 2019/10/14 20:17:16

Re: Grub Menu shows kernels in wrong order

Post by watchingdogs » 2019/10/28 17:57:44

nouvo09 wrote:
2019/10/27 16:18:07
Curiously grub shows the entries of the menu in the same order they are in /boot/loader/entries i-e in alphabetic order !!

Code: Select all

# ls -l /boot/loader/entries
total 12
-rw-r--r--. 1 root root 325 26 oct.  08:15 f78e00f22e9d47c3814a60a9dffa8afb-0-rescue.conf
-rw-r--r--. 1 root root 273 26 oct.  08:15 f78e00f22e9d47c3814a60a9dffa8afb-5.3.7-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 379 25 août  19:08 fb0c7db0921149639d5f00295eb34d23-0-rescue.conf
-rw-r--r--. 1 root root 277  9 oct.  11:03 fb0c7db0921149639d5f00295eb34d23-5.2.18-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 273 16 oct.  07:52 fb0c7db0921149639d5f00295eb34d23-5.3.5-200.fc30.x86_64.conf
-rw-r--r--. 1 root root 273 18 oct.  09:42 fb0c7db0921149639d5f00295eb34d23-5.3.6-200.fc30.x86_64.conf
# 
and UUID are in first place.
I see, however doing grubby --info=ALL does not show these /boot/loader/entries in order. Is there a way to fix what grubby shows to correspond to this list of .conf?

nouvo09
Posts: 146
Joined: 2009/09/19 19:21:36
Location: Paris, France

Re: Grub Menu shows kernels in wrong order

Post by nouvo09 » 2019/10/28 18:25:48

Not I know about.
Member of centos-FR forum

Post Reply

Return to “CentOS 8 - General Support”