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 usesdb
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?