[Fixed] Grub entries for a UEFI Manjaro install are incorrect

On my computer I have three drives:

  • On sda I have a UEFI installation of Manjaro, dating from 2016/04/01. It was a long time ago, but I probably accepted installation defaults. I never had to reinstall Manjaro. I log in to Manjaro occasionally, and Manjaro continues to work without problem.

  • On sdb I once had a Windows installation, but I deleted Windows from my computer years ago, and I use sdb now only for temporary storage and for backups.

  • On sdc I have a legacy (BIOS) installation of EndeavourOS. My computer boots to EndeavourOS automatically, without problem.

My computer operates in “mixed” UEFI/BIOS mode. I configured my computer to boot to sdc by default, and EndeavourOS boots automatically without problem. When I want to boot to Manjaro on sda instead, I simply select Manjaro from the UEFI boot menu (after pressing F12), and Manjaro boots without problem. My problem is that my EndeavourOS-generated Grub menu does not allow me to boot directly to Manjaro.

Here are the partitions and mount points I see when logged into Manjaro:

Partitions and mount points seen from Manjaro

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 298.1G 0 disk
├─sda1 8:1 0 100M 0 part /boot/efi
├─sda2 8:2 0 256M 0 part /boot
├─sda3 8:3 0 290G 0 part /
└─sda4 8:4 0 7.7G 0 part [SWAP]
sdb 8:16 0 465.8G 0 disk
├─sdb2 8:18 0 1K 0 part
└─sdb5 8:21 0 465.8G 0 part
sdc 8:32 0 465.8G 0 disk
├─sdc1 8:33 0 457G 0 part
└─sdc2 8:34 0 8.8G 0 part

Worth noting again:

  • sda has a UEFI installation of Manjaro, and it works perfectly when booting from the UEFI boot menu.
  • sdb is an old Windows drive, decommissioned years ago.
  • sdc has a BIOS installation of EndeavourOS, and it loads automatically, without problem, whenever I reboot my computer.

Further analysis and my solution:

From EndeavourOS, I run this command:

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

When I reboot, the Grub menu shows, in addition to EndeavourOS, all the expected Manjaro boot options. So there are no problems so far.

However, when I select any of the Manjaro options in the Grub menu, Manjaro fails to boot. Instead, a message appears that says that an .img file, such as the following, cannot be found:

/boot/initramfs-5.10-x86_64.img

On my computer, Manjaro’s initramfs-5.10-x86_64.img file resides at the root of a separate boot partition, not inside a /boot folder.

Here’s one of the menu entries for Manjaro in the grub.cfg file generated by EndeavourOS:

One menuentry for Manjaro in EndeavourOS Grub menu
menuentry 'Manjaro Linux (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.10-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
	else
	  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
	fi
	linux /vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
	initrd /intel-ucode.img /boot/initramfs-5.10-x86_64.img
}

The problem is in the final line:

initrd /intel-ucode.img /boot/initramfs-5.10-x86_64.img

This line should be:

initrd /intel-ucode.img /initramfs-5.10-x86_64.img

I easily fixed the problem by adding this code to /etc/grub.d/30_os-prober:

if [[ "${OS}" == *"Manjaro"* ]] ; then
	LINITRD="`echo ${LINITRD} | sed 's/\/boot//g'`"
fi

I added the code above at line 222, after the initrd line is constructed and before it is written to the output stream. It simply strips /boot from the Manjaro initrd lines in the Grub menu. (If you encounter the same problem with Arch, for example, simply replace Manjaro in my code with Arch.) (Also, be aware that some Grub updates, like the update today, overwrite 30_os-prober, in which case you will need to reapply this fix.)

Once again generating grub.cfg and rebooting, all of the Manjaro entries in the Grub menu work without problem.

So, this code easily fixed the problem I was having. However…

My question now is why I was having this problem in the first place. Does the problem lie with grub-mkconfig or with os-prober? Or does the problem lie with EndeavourOS’ grub-tools patch? Or had I done something wrong when I set up this dual-boot computer? :man_shrugging:

*cough*

Just one thing.

:grin:

More seriously, you’re mixing UEFI and BIOS boot modes for no apparent reason - pick one.

3 Likes

I anticipated this response :grin: :japanese_ogre:, so I deliberately emphasized my failure to choose between boot modes in my post above.

Yes, I made a mistake when I installed EndeavourOS many months ago in not choosing the boot mode I had chosen for Manjaro many years ago. I might also have configured my computer to use one boot mode or the other, rather than mixed mode. I know better now.

Still, as I can correct the problem easily by editing /etc/grub.d/30_os-prober, I’m wondering, couldn’t Grub developers write code that detects that .img files reside in the root of a partition rather than inside of a /boot folder? Alternatively, might EndeavourOS’ grub-tools be able to fix this problem?

2 Likes

The only question I have is: What’s the purpose of dual booting Manjaro and EndeavourOS? They are similar enough that either one can replace the other easily, so why go through the trouble of dual booting?

I have no practical reason for dual-booting EndeavourOS with Manjaro. When I left Manjaro many months ago, I installed EndeavourOS on a new drive and I transferred all of my files from Manjaro. The old Manjaro drive has remained on my system, though, but I mostly ignore it.

While I have no further use for Manjaro, I have always wondered why the EndeavourOS-generated Grub menu has failed to boot my old Manjaro installation. Finally, giving in to curiosity a week ago, I decided to investigate. I discovered the problem, I developed a fix, and I posted the fix above.

If anyone has encountered a similar problem, they can use my fix. If the developers of grub-tools want to improve the compatibility of the EndeavourOS-generated Grub menu with Arch-based installations, they now have some additional information that they might find useful.

4 Likes

Could you show the contents of file /boot/grub/grub.cfg on both EndeavourOS and Manjaro disks?

EndeavourOS grub.cfg (without applying my fix)
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
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  add71fe5-b87f-440a-a80c-fb8861360ca5
else
  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_msdos
insmod ext2
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  add71fe5-b87f-440a-a80c-fb8861360ca5
else
  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
fi
insmod gfxmenu
loadfont ($root)/boot/grub/themes/EndeavourOS/unifont-regular-16.pf2
insmod png
set theme=($root)/boot/grub/themes/EndeavourOS/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'EndeavourOS, on linux' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-add71fe5-b87f-440a-a80c-fb8861360ca5' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	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  add71fe5-b87f-440a-a80c-fb8861360ca5
	else
	  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
	fi
	echo	'Loading kernel linux ...'
	linux	/boot/vmlinuz-linux root=UUID=add71fe5-b87f-440a-a80c-fb8861360ca5 rw  quiet resume=UUID=e6851e49-d8c5-4b97-844f-659a2503ea65 loglevel=3 nowatchdog
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry 'EndeavourOS, on linux (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-add71fe5-b87f-440a-a80c-fb8861360ca5' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	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  add71fe5-b87f-440a-a80c-fb8861360ca5
	else
	  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
	fi
	echo	'Loading kernel linux ...'
	linux	/boot/vmlinuz-linux root=UUID=add71fe5-b87f-440a-a80c-fb8861360ca5 rw  quiet resume=UUID=e6851e49-d8c5-4b97-844f-659a2503ea65 loglevel=3 nowatchdog
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-linux-fallback.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
	menuentry 'Manjaro Linux (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.10-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux /vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd /intel-ucode.img /boot/initramfs-5.10-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel 5.10.15-1-MANJARO x64) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.10-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux /vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd /intel-ucode.img /boot/initramfs-5.10-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel 5.10.15-1-MANJARO x64 - fallback initramfs) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.10-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux /vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd /initramfs-5.10-x86_64-fallback.img
	}
	menuentry 'Manjaro Linux (Kernel 5.4.97-1-MANJARO x64) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.4-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux /vmlinuz-5.4-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd /intel-ucode.img /boot/initramfs-5.4-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel 5.4.97-1-MANJARO x64 - fallback initramfs) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.4-x86_64--15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux /vmlinuz-5.4-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd /initramfs-5.4-x86_64-fallback.img
	}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Manjaro grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

set menu_color_normal=light-gray/black
set menu_color_highlight=green/black

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda
else
  search --no-floppy --fs-uuid --set=root 15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda
else
  search --no-floppy --fs-uuid --set=root 15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda
fi
insmod png
background_image -m stretch /usr/share/grub/background.png
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
	savedefault
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
	else
	  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
	fi
	linux	/vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw  resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
	initrd	/intel-ucode.img /initramfs-5.10-x86_64.img
}
submenu 'Advanced options for Manjaro Linux' $menuentry_id_option 'gnulinux-advanced-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
	menuentry 'Manjaro Linux (Kernel: 5.10.15-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.15-1-MANJARO x64-advanced-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
	savedefault
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux	/vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw  resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd	/intel-ucode.img /initramfs-5.10-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel: 5.10.15-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.15-1-MANJARO x64-fallback-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux	/vmlinuz-5.10-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw  resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd	/initramfs-5.10-x86_64-fallback.img
	}
	menuentry 'Manjaro Linux (Kernel: 5.4.97-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.97-1-MANJARO x64-advanced-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
	savedefault
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux	/vmlinuz-5.4-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw  resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd	/intel-ucode.img /initramfs-5.4-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel: 5.4.97-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.97-1-MANJARO x64-fallback-15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
		else
		  search --no-floppy --fs-uuid --set=root dfb33672-805e-4594-9b62-27b91c993992
		fi
		linux	/vmlinuz-5.4-x86_64 root=UUID=15f79ea7-d6a3-46b3-9de0-3b74e1ef2eda rw  resume=UUID=141cccf2-b626-4a0d-8d01-8bd0139d76fc
		initrd	/initramfs-5.4-x86_64-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'EndeavourOS Linux (rolling) (on /dev/sdc1)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-add71fe5-b87f-440a-a80c-fb8861360ca5' {
	savedefault
	insmod part_msdos
	insmod ext2
	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  add71fe5-b87f-440a-a80c-fb8861360ca5
	else
	  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
	fi
	linux /boot/vmlinuz-linux root=UUID=add71fe5-b87f-440a-a80c-fb8861360ca5 rw quiet resume=UUID=e6851e49-d8c5-4b97-844f-659a2503ea65 loglevel=3 nowatchdog
	initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for EndeavourOS Linux (rolling) (on /dev/sdc1)' $menuentry_id_option 'osprober-gnulinux-advanced-add71fe5-b87f-440a-a80c-fb8861360ca5' {
	menuentry 'EndeavourOS, on linux (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--add71fe5-b87f-440a-a80c-fb8861360ca5' {
		savedefault
		insmod part_msdos
		insmod ext2
		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  add71fe5-b87f-440a-a80c-fb8861360ca5
		else
		  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
		fi
		linux /boot/vmlinuz-linux root=UUID=add71fe5-b87f-440a-a80c-fb8861360ca5 rw quiet resume=UUID=e6851e49-d8c5-4b97-844f-659a2503ea65 loglevel=3 nowatchdog
		initrd /boot/intel-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'EndeavourOS, on linux (fallback initramfs) (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--add71fe5-b87f-440a-a80c-fb8861360ca5' {
		savedefault
		insmod part_msdos
		insmod ext2
		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  add71fe5-b87f-440a-a80c-fb8861360ca5
		else
		  search --no-floppy --fs-uuid --set=root add71fe5-b87f-440a-a80c-fb8861360ca5
		fi
		linux /boot/vmlinuz-linux root=UUID=add71fe5-b87f-440a-a80c-fb8861360ca5 rw quiet resume=UUID=e6851e49-d8c5-4b97-844f-659a2503ea65 loglevel=3 nowatchdog
		initrd /boot/initramfs-linux-fallback.img
	}
}

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {
        search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  dfb33672-805e-4594-9b62-27b91c993992
        linux16 /memtest86+/memtest.bin 
    }
fi
### END /etc/grub.d/60_memtest86+ ###
1 Like

but … looks like EndeavourOS one is legacy MBR and Manjaro is EFI / gpt ?

Yes. See original post.

Quick update:

@manuel has developed a fix for this problem. I have tested, and it works perfectly. I imagine that we’ll be seeing the new version of grub-tools in the endeavouros repo very soon.

By the way, working with @manuel was a real pleasure! :grinning:

3 Likes

Thanks for bringing this issue up! Upstream grub has a small issue with this, and as @kwg said, we’ll fix it with the grub-tools package.

Sadly upstream devs (I’m talking about Debian) haven’t fixed the grub&os-prober bugs despite the reports and suggested solutions.

3 Likes

… saw today grub-tools was updated

1 Like

Wait, so you say it’s possible to mix up legacy MBR and EFI boots in one boot menu ?

Sure looks like it! :sweat_smile:

But I didn’t do it… @kwg did!

1 Like

Even before @manuel’s fix, the EndeavourOS-generated grub.cfg file correctly identified each installation as either MBR or EFI. In my case, the only problem was that the initrd lines in grub.cfg failed to locate correctly the .img files of an EFI installation, in the root of a separate boot partition. With @manuel’s fix, in my case at least, the initrd lines now correctly locate the .img files, and the EndeavourOS-generated Grub menu now boots both MBR and EFI installations without problem.

1 Like

It may be because some motherboards (like yours?) support both UEFI and legacy BIOS booting?

My motherboard supports both UEFI and legacy BIOS boot modes. The default configuration is “mixed,” which allows booting from drives partitioned either way.

I have seen advice (not only in this forum thread) that one should select one boot mode or the other before installing Linux. I did not heed this advice. I installed EndeavourOS in BIOS mode on a new drive years after having installed Manjaro on a different drive in UEFI mode.

As @manuel and I have discovered, it actually is possible to generate a grub.cfg file that allows selecting and booting, from the EndeavourOS-genearted Grub menu, both UEFI and BIOS installations on the same system.

2 Likes

This is interesting. But it seems to require motherboard support.

How old is your motherboard?
I’m just trying to think which motherboards might support this. I guess the latest motherboards mostly support only UEFI booting. And of course about 10 or more years old motherboards support only legacy BIOS booting (not speaking of very old motherboards :wink:).
So about 5…10 years old motherboards may support both UEFI and legacy BIOS booting?

$ sudo dmidecode -t 2

Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B85M-DS3H-A

I bought this motherboard in March 2016. It supports booting both UEFI and legacy BIOS installations.

Many ASUS boards do the same - if CSM is enables, and the either/or mode is turned on…

I only found this for sure on my B450Plus - but I thiink it was on an earlier one too. Haven’t even considered BIOS mode since, though - so I don’t know if my Asus TUF X570 can do it…

1 Like