You are here:Home»KB»Linux»Linux will not boot in a Virtual Machine - Stuck at UEFI Interactive Shell
Monday, 30 October 2023 09:55

Linux will not boot in a Virtual Machine - Stuck at UEFI Interactive Shell

Written by

So you have finished installing your Linux OS on your Virtual Machine and then you get the following error when the system reboots. I have also had a simliar issue when trying to boot of a CD/DVD. You will note this issue only occurs when using UEFI/EFI boot technology and not MBR. You should always use UEFI/EFI where possible.

And just for people search from the internet this is the message in text

Press ESC in 1 seconds to skip startup.nsh or any other key to continue.

This problem seems to only affect some Linux distributions, so far I have experience it with:

  • CentOS
  • Debian

This issue can happen on any Hypervisor but the ones I have had experience with are:

  • KVM
  • VirtualBox

 

The Cause

This is caused by the VM looking in the wrong place for the boot file, or the boot file is in the wrong place, not sure which is more correct but the outcome is the same.

 

Solutions

There are two methods of fixing this which we will go through below. Both allow the system to find the required boot file.

 

Method 1 - Manually add an entry to the UEFI boot order (preferred)

  • Different distros might have different locations for the boot file but the fix should be the same or similar.
  • This should stay after kernel updates.
  • This fix can be done without booting into an OS.

 

  1. When at the interactive shell, type exit

  2. You are now on the Bhyve boot screen
  3. Select 'Boot Maintenance Manager'
  4. Select 'Boot Options'
  5. Select 'Add Boot Option'
  6. You are now in the File Explorer
  7. Select 'NO VOLUME LABEL'. The name might be different on your system.
  8. Select '<EFI>'
  9. Select '<debian>'. The name might be different on your system.
  10. Select 'grubx64.efi'. The name might be different on your system.
  11. You have now finished with the File explorer.
  12. Input the description, in this case 'Debian'.


  13. Commit and Changes and Exit
  14. Change Boot Order
  15. Your screen should look like this, just press enter.
  16. Move 'Debian' to the top
  17. Commit Changes and Exit
  18. Done, you can reboot now.

 

Method 2 - Copy the boot file to the correct location

  • Different distros might have different locations for the boot file but the fix should be the same or similar.
  • This might get wiped out upon kernel updates.
  • You need to boot into the OS to correct this issue using this method.

 

  • When at the interactive shell, type exit

  • You are now on the Bhyve boot screen
  • Select 'Boot From File'
  • Select '<EFI>'
  • Select '<debian>'. The name might be different on your system.
  • Select 'grubx64.efi'. The name might be different on your system.
  • Your VM will now boot up to your selected OS.
  • Now we have booted the VM it is time to put the boot file where it needs to be.
  • Login as root
  • Navigate to the EFI directory of your operating system.
    cd /boot/efi/EFI/debian/
  • Check you are in the right directory by check to see if grubx64.efi exists. This is the boot file that needs to be loaded but it is in the wrong place.
    ls
  • Make a copy of grubx64.efi into the correct location
    mkdir /boot/efi/EFI/BOOT/
    cp grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi
  • You can now reboot or shutdown your PC.
    reboot
    shutdown

 

Notes

Read 997 times Last modified on Monday, 30 October 2023 17:31