27

Problem with VirtualBox 5.x running on GNU/Linux Debian 9.x host:

EFI-enabled guest suddenly boots only into UEFI Interactive Shell.

UEFI Interactive Shell

It waits for 5 seconds and then it drops to Shell>.

I don't remember any modifications, which I would have done, neither to the host, nor guest, or VirtualBox itself.

1
  • 1
    VirtualBox 5.x did not have real persistent storage for UEFI NVRAM boot settings: an OS installer would be able to create NVRAM settings for the installed OS, and they would persist when the OS inside the VM was rebooted, but after shutting down the entire VM, the settings would be lost. Several workarounds existed, like the use of startup.nsh or ExtraDataItems in the .vbox file, but these may no longer be applicable as the UEFI support has been significantly reworked in VirtualBox version 6.1. Commented Jun 14, 2021 at 7:41

4 Answers 4

32

Plausible fix:

  1. In UEFI Interactive Shell, enter the file system:

    fs0: 
  2. Following up with creating this file:

    edit startup.nsh 
  3. Enter this or similar line to it:

    \EFI\debian\grubx64.efi 

    On arm64 you'd write \EFI\debian\grubaa64.efi instead. You can do ls \EFI\debian\ to see what is available.

  4. Press CTRL+S to save the file.

  5. Press ENTER to confirm the file name.

  6. Press CTRL+Q to exit the editor.

  7. Restart the Guest:

    reset 

Important notes:

  1. For some reason you have only a few seconds to edit and save the file. If it takes you longer, then the guest may react with a significant delay. Or it may even freeze.

  2. Replace debian with your system's id, e.g. ubuntu. You may verify this by simply going into the \EFI\ directory and running ls.


Another way:

If you don't succeed, and supposing your guest is Linux type, I myself had to do it:

  1. Boot from live USB with any Linux.

  2. Mount the root file system.

  3. Create this file on the mounted file system, adjust the path to wherever you have mounted it:

    /boot/efi/startup.nsh 
  4. Enter the above explained line to it.

3
  • Followed the first 7 steps and it worked. My situation is a bit different, fresh install of Arch Linux on QEMU/KVM. Although I can login now, I don't understand why this happened in the first place. So I am not sure if it will happen again. Would you please provide a few guesses :-) ? Commented Apr 24, 2023 at 3:39
  • @hba Unfortunately, I do not know why this is happening. Sorry. Commented Apr 24, 2023 at 7:07
  • ctrl-s and ctrl-q do nothing at all in that editor. Commented Nov 8, 2023 at 3:57
5

Workaround:

In the VirtualBox settings for your VM, go to System settings and in the Motherboard section un-check the

Enable EFI (Special OSes only).

Save the settings and restart your VM.


Important notes:

  1. This will make the guest system run on BIOS / MBR legacy boot.

  2. Only use, if the solution above does not work for you.

3
  • Yes, thank you! It was necessary to Enable EFI in order to make the GParted Live CD work. However, after resizing the disk partitions in GParted, I encountered this error, and also an error "fs0 is not a correct mapping" if I tried to enter the file system. Disabling this flag solved issue. Commented Oct 25, 2018 at 5:35
  • But how do I shutdown virtual machine? Commented Apr 8, 2019 at 7:21
  • if i disable that option after that it's not able to find bootable medium, even manually also it didn't worked Commented Apr 5, 2020 at 17:32
3

Although the original question is for a Linux host, I'm running VirtualBox on a MacBook Pro with Apple Silicon, and it appears that AMD64 images are not supported. The only way I managed to get past this UEFI shell was to use an Ubuntu server for Arm image. Could not find an official desktop image, see related question.

Also just started experimenting with Multipass on MacOS, which reminds me of WSL, despite being two different things.

-1

I had this come-up today. In my case, I had selected "Enable EFI" on the Settings: System panel, on the Motherboard tab. That was conscious because the drive I wanted to boot from wasn't (booting).

This can be removed by unchecking the check-box.

While it looks useful, it is very frustrating so I advise people to open a web page with the help output on show. All the commands scroll off the screen before you have a chance to read them. And there is no less or more command.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.