grub2 will not boot RHEL8 install on new disk

General support questions
Post Reply
r_hartman
Posts: 711
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

grub2 will not boot RHEL8 install on new disk

Post by r_hartman » 2021/06/07 10:29:30

Hi all, please bear with me as it's a bit of a story.

I'm running CentOS 7.9 fully updated in a dual-boot setup with Win10 on separate SSDs.
The Win disk was detected by grub2 and added to the menu a long time ago, and selecting either OS works fine.
Now I disconnected both SSDs, installed RHEL 8.4 on a new SSD and reconnected the original drives.
Through the BIOS boot disk selector, I can select and boot each OS without issues, and the functionality through grub also still works.

Obviously, RHEL 8 was not on the Centos 7 grub menu, so I ran grub2-mkconfig to update the menu, and it added two entries for RHEL 8.
However, I can not boot from either of those entries as they give me an error that the uuid cannot be found:

Code: Select all

Error: no such device: 7f30c7cf-3878-43c6-a754-9220538f63bc.
Error: file '/vmlinuz-0-rescue-57c550b7375c47f2a7abffba259636d2 not found.
Error: you need to load the kernel first.

Press any key to continue...
The uuid is the correct uuid for the disk and the disk and partition numbers appear to be correct too.

I then booted RHEL 8 and ran grub2-mkconfig there too. That one does not find the Win disk, but it does add two CentOS 7 entries to the grub menu which behave exactly like the entries in the CentOS 7 grub menu.

As I currently have CentOS 7 as my main OS with all the tweaks and multimedia stuff, I want to keep that my bootdisk and be able to boot RHEL 8 through the grub menu.

A working CentOS 7 entry looks like this:

Code: Select all

menuentry 'CentOS Linux (3.10.0-1160.25.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.25.1.el7.x86_64-advanced-e03783d5-d456-48c2-b8e0-b2a518349d3b' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod xfs
	set root='hd2,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1  aca29b0b-a258-4196-b501-6af141b06444
	else
	  search --no-floppy --fs-uuid --set=root aca29b0b-a258-4196-b501-6af141b06444
	fi
	linux16 /vmlinuz-3.10.0-1160.25.1.el7.x86_64 root=/dev/mapper/cl_hacvmh01-root ro cl_hacvmh01/root rd.lvm.lv=cl_hacvmh01/swap nouveau.modeset=0 rd.driver.blacklist=nouveau vga=0x34A 
	initrd16 /initramfs-3.10.0-1160.25.1.el7.x86_64.img
A non-working RHEL 4 entry looks like this:

Code: Select all

menuentry 'Red Hat Enterprise Linux release 8.4 (Ootpa) (on /dev/mapper/rhel_hacvmh02-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-c8dec39a-c017-426c-9b3c-d10b0b160f89' {
	insmod part_msdos
	insmod xfs
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  7f30c7cf-3878-43c6-a754-9220538f63bc
	else
	  search --no-floppy --fs-uuid --set=root 7f30c7cf-3878-43c6-a754-9220538f63bc
	fi
	linux /vmlinuz-0-rescue-57c550b7375c47f2a7abffba259636d2 root=/dev/mapper/rhel_hacvmh02-root
	initrd /initramfs-0-rescue-57c550b7375c47f2a7abffba259636d2.img
The uuids are correct, as are the drive numbers, as shown by the output of lsblk -f:

Code: Select all

$ lsblk -f
NAME                FSTYPE      LABEL           UUID                                   MOUNTPOINT
sda                                                                                    
├─sda1              xfs                         7f30c7cf-3878-43c6-a754-9220538f63bc   
└─sda2              LVM2_member                 go4PFa-HYUM-tpgB-aUwL-LPTm-iNEG-yLeXCx 
  ├─rhel_hacvmh02-swap
                    swap                        5c220e82-7b37-4838-b279-efbd948e7afd   
  ├─rhel_hacvmh02-home
                    xfs                         c5ddcd97-8f8b-4246-9580-b73a633d0baf   
  └─rhel_hacvmh02-root
                    xfs                         c8dec39a-c017-426c-9b3c-d10b0b160f89   
sdb                                                                                    
├─sdb1              ntfs        System Reserved EEDA8311DA82D56D                       
├─sdb2              ntfs                        D25084135083FD0B                       
└─sdb3              ntfs                        5698765898763719                       
sdc                                                                                    
├─sdc1              xfs                         aca29b0b-a258-4196-b501-6af141b06444   /boot
└─sdc2              LVM2_member                 Qt7djZ-m1f6-raKU-Wp4P-tGiP-xHTH-FVSnPC 
  ├─cl_hacvmh01-root
                    xfs                         e03783d5-d456-48c2-b8e0-b2a518349d3b   /
  ├─cl_hacvmh01-swap
                    swap                        57b00ddc-e96b-4982-8a7d-93a8971fb1a4   [SWAP]
  └─cl_hacvmh01-home
                    xfs                         e4b26537-7eca-4271-a530-3a9a6701ad50   /home
The notable differences between the working and non-working entries are the omission of the 'ro' and the 'rd.lvm.lv=' directives in the RHEL 8 /vmlinuz line. I have not tried to add them manually yet, as grub appears not to find the disk to begin with.
All the filenames mentioned in the RHEL8 entries do exist in /boot on the RHEL 8 disk.

my /etc/default/grub looks like:

Code: Select all

$ sudo cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=cl_hacvmh01/root rd.lvm.lv=cl_hacvmh01/swap nouveau.modeset=0 rd.driver.blacklist=nouveau vga=0x34A"
GRUB_DISABLE_RECOVERY="true"
If you made it this far, thanks for bearing with me.
I think I provided all the relevant information. I did do a lot of investigation prior, but everything I found had to do with booting Windows (chainloading) and/or mismatching uuids, which is clearly not the case here. I guess I could add a chainloader entry for hd0 in /etc/grub.d/40_custom, but I'd still end up with the invalid auto-generated entries in my menu, so I don't consider that a proper solution.

I now have no ideas where to look further, so I came here.

Any ideas? Thanks.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: grub2 will not boot RHEL8 install on new disk

Post by TrevorH » 2021/06/07 11:08:00

There is at last one major difference between el7 and el8 grub and that is the addition of BLSCFG. I'd suspect that the error may reside there.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

r_hartman
Posts: 711
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

Re: grub2 will not boot RHEL8 install on new disk

Post by r_hartman » 2021/06/07 11:29:56

I did notice that. I first encountered it when upgrading Fedora 29 to Fedora 30.
But imho it doesn't even get that far as grub fails to find the disk to begin with, even though it's supposed to search by uuid, which is valid, so it has no idea what OS is on it at the time it fails.

r_hartman
Posts: 711
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

Re: grub2 will not boot RHEL8 install on new disk

Post by r_hartman » 2021/06/07 11:34:24

In hindsight, I could've made a very short post stating 'grub2 fails to find new disk while uuid matches'...
Until it finds the disk all the rest is pretty irrelevant. :shock:

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: grub2 will not boot RHEL8 install on new disk

Post by TrevorH » 2021/06/07 12:16:15

is set root='hd0,msdos1' correct?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

r_hartman
Posts: 711
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

Re: grub2 will not boot RHEL8 install on new disk

Post by r_hartman » 2021/06/07 12:32:15

TrevorH wrote:
2021/06/07 12:16:15
is set root='hd0,msdos1' correct?
I'm under the assumption that that directive sets the target disk/partition, which would be partition 1 on disk 0.
If that assumption is correct, in my opinion the directive is correct as that would be sda1, which indeed has the proper uuid.

My assumption is based on the similar directive for the CentOS 7 boot disk/partition, which has set root='hd2,msdos1', pointing to sdc1, which again has the proper uuid, as shown by the lsblk -f output.

r_hartman
Posts: 711
Joined: 2009/03/23 15:08:11
Location: Netherlands
Contact:

Re: grub2 will not boot RHEL8 install on new disk

Post by r_hartman » 2021/06/07 12:40:51

Confirming output of fdisk -l (removed /dev/sdb and all /dev/mapper entries from the list):

Code: Select all

$ sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0ae1bc1e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200  1953523711   975712256   8e  Linux LVM

Disk /dev/sdc: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008e5e1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     2099199     1048576   83  Linux
/dev/sdc2         2099200   976773119   487336960   8e  Linux LVM

Post Reply