Can't get UEFI boot order to work properly. BdsDxe: Failed to load Boot0001 "UEFI VBOX HARDDISK". Arch linux Virtualbox-iso



OS: Manjaro XFCE x86_64
Apps: packer (plugins: virtualbox-iso), 


OS:                Arch Linux  
Hypervisor:        Virtualbox 
Architecture:      x64

I’ve built a vagrant for Virtualbox, but I’m not completely there yet.
One of the things that I want in my VM is for it to be modern,
so I want to use of UEFI, but I haven’t been able to fully figure out,
how to construct it for VMs.

Which is why I’m confronted with this issue:

UEFI fails to load properly. BdsDxe: failed to load Boot0001 "UEFI VBOX Harddisk"

See below in image:

I’ve noticed that checking the boot order given for my box does not correspond what virtualbox can find, so I’m wondering why this is.

I have only two options in the Virtualbox of which the former is the harddisk boot, which it can’t find and the second is starting some kind of network boot?

I just want to get into GRUB.

During the building of the vagrant box, I call efibootmgr to see what my Disk should be giving as it’s boot order.

output of efibootmgr

SE_bastille-installer-box.virtualbox-iso.archlinux: ==> Check boots..
SE_bastille-installer-box.virtualbox-iso.archlinux: BootCurrent: 0001
SE_bastille-installer-box.virtualbox-iso.archlinux: Timeout: 0 seconds
SE_bastille-installer-box.virtualbox-iso.archlinux: BootOrder: 0005,0000,0002,0003,0004
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0000* UiApp   FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0002* UEFI VBOX HARDDISK    PciRoot(0x0)/Pci(0xf,0x0)/SCSI(0,0){auto_created_boot_option}
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0003* UEFI PXEv4 (MAC:0800277E9510)   PciRoot(0x0)/Pci(0x3,0x0)/MAC(0800277e9510,1)/IPv4(,0,0){auto_created_boot_option}
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0004  EFI Internal Shell   FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0005* GRUB   HD(1,GPT,1e8f8680-99c0-4c28-b83a-eb601805d4c4,0x800,0x96000)/File(\EFI\GRUB\grubx64.efi)

Below is the script that builds the boot loader.

#!/usr/bin/env bash

. /root/

# stop on errors
set -eu

echo "==> ${NAME_SH}: Installing grub packages.."
/usr/bin/arch-chroot ${ROOT_DIR} /usr/bin/pacman --noconfirm -S edk2-ovmf efibootmgr grub os-prober >/dev/null

echo "==> ${NAME_SH}: Pre-configure grub.."
/usr/bin/arch-chroot ${ROOT_DIR} sed -i 's/#GRUB_DISABLE_OS_PROBER/GRUB_DISABLE_OS_PROBER/' /etc/default/grub

echo "==> ${NAME_SH}: Installing grub.."
/usr/bin/arch-chroot ${ROOT_DIR} grub-install --target=x86_64-efi --efi-directory=${ESP_DIR} --bootloader-id=GRUB &>/dev/null
/usr/bin/arch-chroot ${ROOT_DIR} grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null

echo "==> ${NAME_SH}: Check boots.."
if [[ $PACKER_BUILDER_TYPE == "virtualbox-iso" ]]; then
  /usr/bin/arch-chroot ${ROOT_DIR} efibootmgr --delete-bootnum --bootnum 1
/usr/bin/arch-chroot ${ROOT_DIR} efibootmgr

The EFI file can be found in shell, so I’m doing at least something correctly.

And I can add the boot option so that it will work, but I want box to work… well… out of the box!

My packer build file

What am I doing wrong?

Looks like the Arch Linux forum has the answer here


echo "==> ${NAME_SH}: Installing grub.."
/usr/bin/arch-chroot ${ROOT_DIR} grub-install --target=x86_64-efi --efi-directory=${ESP_DIR} --bootloader-id=GRUB --removeable &>/dev/null