[ModEdit; related ticket: #15835: UEFI NVRAM seems to broken]
I am having issues with VirtualBox 5.2.8 and CentOS 7.4 [1708]. One can install CentOS 7.4 on a VirtualBox 5.2.8 system with EFI BIOS enabled, and reboot without issue. However, when the VM is powered down, the CentOS system will no longer boot when the VM is brought back up again - instead, the UEFI Interactive Shell is shown.
Steps to replicate the issue:
1) Create a new Linux VM in VirtualBox 5.2.8 (Red Hat Linux 64-bit, 4GB of memory, accept 8GB default disk size and type).
2) Go to Settings -> System -> Extended Features, and tick the box "Enable EFI (special OSes only)". Select the boot media for the CD/DVD device.
3) Start the virtual machine, and install a minimal install of CentOS, with all the defaults (including default disk layout.)
4) When the install is finished, click the "Reboot" button, and observe that the system will boot in UEFI mode.
5) Shut the system down (either select ACPI Shutdown, or power-off the machine manually from the command line.)
6) Start the virtual machine back up again. Note that it will not boot - you will get the UEFI Interactive Shell, instead of GRUB.
Briefly before the UEFI Interactive Shell appears, there is an error message:
Code: Select all
Boot failed. EFI DVD/CDROM
Failed to open \EFI\BOOT\grubx64.efi - Not Found
Failed to load image \EFI\BOOT\grubx64.efi: Not Found
start_image() returned Not Found
I did raise this issue on the CentOS forum, but the issue appears to lie with VirtualBox's EFI implementation. CentOS certainly works fine on all the hardware I tested (and VMware ESXi) in EFI mode. Several reasonable workarounds were discussed (which I'll repeat below), but a fix for VirtualBox would be appreciated.
The workarounds, in order of opportunity and efficiency:
1) When installing, wait for the "Reboot" button to appear, then press Ctrl-Alt-F2 to get a shell, then enter:
Code: Select all
cp -p /mnt/sysimage/boot/efi/EFI/centos/grubx64.efi /mnt/sysimage/boot/efi/EFI/BOOT/
2) On first boot, sudo to (or login as) root, then enter:
Code: Select all
cp -p /boot/efi/EFI/centos/grubx64.efi /boot/efi/EFI/BOOT/
3) When the VM has been started again, and won't boot, wait until the VM automatically enters the UEFI Shell, then enter:
Code: Select all
cp fs0:\EFI\centos\grubx64.efi fs0:\EFI\BOOT
fs0:\EFI\BOOT\grubx64.efi
4) When the VM has been started again, and won't boot, wait until the VM automatically enters the UEFI Shell, then enter:
Code: Select all
edit startup.nsh
Code: Select all
fs0:\EFI\centos\grubx64.efi
Thanks go to the CentOS forum's TrevorH, avij and owl102 for information leading to the first two workarounds (TrevorH), and the third workaround (direct tip from avij) and a link to the fourth workaround (direct tip from owl102, fourth tip written by AskUbuntu.com's emash.)