View Issue Details

IDProjectCategoryView StatusLast Update
0014565CentOS-7grub2public2018-03-08 19:45
ReporterOliver Jones 
Status newResolutionopen 
PlatformVirtualBox 5.1.x and 5.2.xOSMicrosoft WindowsOS VersionWindows 7 SP1
Product Version7.4.1708 
Target VersionFixed in Version 
Summary0014565: CentOS 7.4 [1708] - boot problems in UEFI mode on VirtualBox 5.x
DescriptionUnder VirtualBox, a CentOS-based VM will not boot in UEFI mode if the VM is shut down after installation. An initial boot (from install media) works fine, as does the first (and subsequent) boots from the hard disk. But, when the virtual machine is powered down and up again, the CentOS installation will fail to boot.
Steps To Reproduce1) 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.
Additional InformationI also created a thread on the CentOS forum, here:
TagsNo tags attached.




2018-03-08 19:12

administrator   ~0031396

Last edited: 2018-03-08 19:45

View 2 revisions

confirmed issue with virtualbox current implementation of UEFI. Nothing much we can do about it but provide the possible workarounds you have found in the centos and virtualbox forums.

virtualbox bug entry:

<cut/paste from the virtualbox forum:>
RHEL 7.4 works with EFI boot after power cycle. CentOS 7.4 does not.

Postby Oliver Jones ยป 8. Mar 2018, 18:02

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:

    cp -p /mnt/sysimage/boot/efi/EFI/centos/grubx64.efi /mnt/sysimage/boot/efi/EFI/BOOT/

Press Ctrl-Alt-F6 to return to the installer screen, then click the "Reboot" button to finish. The VM should now behave itself after future power cycles (real or virtual).

2) On first boot, sudo to (or login as) root, then enter:

    cp -p /boot/efi/EFI/centos/grubx64.efi /boot/efi/EFI/BOOT/

The VM can be safely powered down after this point, and restarted again without further issues.

3) When the VM has been started again, and won't boot, wait until the VM automatically enters the UEFI Shell, then enter:

    cp fs0:\EFI\centos\grubx64.efi fs0:\EFI\BOOT

The first line will copy the required file, making startup automatic in future. The second line will start GRUB2 for you, without requiring a further reboot.

4) When the VM has been started again, and won't boot, wait until the VM automatically enters the UEFI Shell, then enter:

    edit startup.nsh

Within the editor, add the following line:


Press F2 to save the file, press Enter to accept the default name [startup.nsh] and then press F3 to exit the editor. Either reboot or enter the last line of workaround 3 to start GRUB2 directly.

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's emash.)


Issue History

Date Modified Username Field Change
2018-03-08 11:52 Oliver Jones New Issue
2018-03-08 19:12 tru Note Added: 0031396
2018-03-08 19:45 tru Note Edited: 0031396 View Revisions