CentOS 7 not visible in grub menu made by Leap 15.1

I’ve never used CentOS. Perhaps it uses some non-standard paths that “os-prober” is not checking.

You can use “/etc/grub.d/40_custom” to permanently add those lines to your “grub.cfg”.

Do the following:

Firstly, install on a USB stick an openSUSE Leap 15.0 with a separate /boot partition
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915231#post2915231
and get that 15.0 booting
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915232#post2915232

Secondly, on the same USB stick, install an openSUSE Leap 15.1, in order to create a dual-boot
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915239#post2915239

Leap 15.0 then is not visible in the GRUB2 menu made by Leap 15.1.

[quote="“ratzi,post:22,topic:137997”]

Do the following:

Firstly, install on a USB stick an openSUSE Leap 15.0 with a separate /boot partition
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915231#post2915231
and get that 15.0 booting
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915232#post2915232

Secondly, on the same USB stick, install an openSUSE Leap 15.1, in order to create a dual-boot
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915239#post2915239

Leap 15.0 then is not visible in the GRUB2 menu made by Leap 15.1.[/QUOTE]

Oooops, sorry, I was wrong, and it is very likely that you’re right, nrickert.

See
https://forums.opensuse.org/showthread.php/537614-Lost-knowledge-just-do-not-install-GRUB2-into-Master-Boot-Record-(MBR)-though-this-is-the-default?p=2915259#post2915259

Thank you, that’s better than manual edit after every grub update.

I just experimentally installed CentOS 8 (in a virtual machine).

I took the option to encrypt the system. And it does use a separate “/boot”. I mostly took defaults. So the root file system is “xfs”, while “/boot” is using “ext4”.

Did you, by any chance, use encryption for your CentOS install? Because that would explain why CentOS does not show up in the grub2 menu. You have to unlock the encrypted partition if you want “os-prober” to find it.

Well, thank you. All partitions with exception of /boot are encrypted.

Then I think all is explained.

You can run “cryptsetup” (as root) to unlock the CentOS partitions(s). And then

grub2-mkconfig -o /boot/grub2/grub.cfg

should generate a grub menu with an entry for CentOS.

You could also automate that, by putting an entry in “/etc/crypttab”. But then you would be prompted for the encryption key on every boot, instead of only when you want to regenerate “grub.cfg”.

Or just continue use “/etc/grub.d/40_custom”.

I’ve tried

cryptsetup luksOpen /dev/sda7 my_secure_partion7
cryptsetup luksOpen /dev/sda9 my_secure_partion9

mount /dev/mapper/my_secure_partion7 /mnt/sda7
mount /dev/mapper/my_secure_partion9 /mnt/sda9

grub2-mkconfig -o /boot/grub2/grub.cfg 

But it doesn’t work.