Hybrid Bootable USB Flash Drive: UEFI & Legacy BIOS

I am a newbie, and I want to create a bootable USB flash drive with Manjaro that is compatible with both older BIOS systems and newer UEFI systems. This must be possible because bootable media comes this way for maximum compatibility.

I have an ASUS Rampage IV Extreme motherboard that supports both BIOS and UEFI boot. So I use this system for testing.

I have already created a Manjaro bootable USB flash drive with GPT partition scheme. The system currently boots in legacy BIOS mode, and I’d like to add UEFI boot to this existing system, if possible. My partition scheme is as follows.

  1. 537 MB, FAT 32, mounted at /boot
  2. 43 GB, XFS, mounted at Filesystem Root
  3. 64 GB, XFS, mounted at /home
  4. 4.3 GB, Linux Swap

There is approximately 7.3 GB of free space at the end.

I had thought that I need to create an EFI System partition. So I created a 5th partition:

  1. 537 MB, FAT 32, EFI System mounted at /boot/efi.

I have the following packages installed: efibootmgr, dosfstools, grub. I entered the following commands at the terminal.

sudo mkdir /boot/efi
sudo mount /dev/sde5 /boot/efi
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

Output is:
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.

I then tried:

sudo modprobe efivarfs
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

But the output was the same.

Is this the correct method to accomplish what I want? If so, what do I need to do differently? If not, how can I create a “mixed mode” bootable USB flash drive? If you can give step-by-step instructions explaining what each command does, that would help me learn.

Thanks for any help!

Maybe you can just install a bootable rEFInd on another partition of the USB as well, and just select that at boot on an UEFI system. And boot into Manjaro from that? I don’t know if rEFInd will be able to detect the legacy boot Manjaro or not, but doesn’t hurt to try.

for UEFI

UEFI, create a profile and save for Windows and another for linux

recheck all option in your UEFI ( for linux)

SecureBoot off
Fast Boot off
No CSM
No Legacy
all disks on AHCI

boot only on UEFI:<partition 1> → EFI install manjaro

you can check in terminal , before install

inxi  -Fxza
test -d /sys/firmware/efi && echo efi || echo bios
sudo efibootmgr -v
sudo parted -l 

here /boot should have Boot & esp if you want to boot in UEFI ( add flag with gparted )
in this case /boot/efi is not required

check that /etc/fstab on your disk ( by chroot ) you have /boot & Fat32 declared

then

sudo lsblk -fs
sudo manjaro-chroot -a 
cat /etc/fstab ( UUID should be ok for /boot & flag  if not correct this )
nano /etc/fstab ( correct and save ) 
exit ( end chroot , NEED TO REDO for new info /boot UUID )

then you can ( for /boot as ESP in fat32 )

sudo manjaro-chroot -a
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=manjaro --recheck --verbose
mkinitcpio -P
update-grub
efibootmgr -v ( check line entre manjaro here ) 
exit ( end-chroot )

Thanks very much for the replies. I will see if I can follow instructions and get this working when I have some time on the weekend.