I installed Ubuntu 14.10 in VirtualBox with UEFI. But now I have rebooted this OS and now it boots into a UEFI Interactive Shell v2.0. How can I boot normally into Grub again?
I encountered the same problem and found that if I issue following command in the interactive shell, the virtual machine would boot into Ubuntu:
(Use backslash, forward slash does not work. Commands in UEFI interactive shell are case insensitive.)
My VirtualBox version is 4.3.20 r96997, Ubuntu version is 14.10 AMD64. I do not know why this happens and how to solve it. Just found this not elegant and still a little bit troublesome workaround.
I read this, tracked down to a bug report and found a better workaround.
Workaround in Update 1 failed. I turned off the virtual machine, launched it. And it booted into UEFI Interactive shell again. According to this, the problem was probably cause by a VirtualBox bug. I am still looking for further solution to this.
Finally found an solution. According to this, you need to create a startup.nsh script manually. Except for the method in mentioned post, you can also do this:
$ sudo mount /dev/sda1 /mnt $ cd /mnt $ sudo sh -c "echo '\EFI\ubuntu\grubx64.efi' > startup.nsh"
3"It is currently not possible to manipulate EFI variables from within a running guest" The solution in your second update to move whatever bootloader you want to use on the ESP to
\EFI\boot\bootx64.efisounds like the better solution to me than wasting 5 soconds wating for startup.nsh. Note: You can press F12 during boot or enter
exiton the EFI shell to access the firmware settings and modify all kinds of things, including the terminal resolution, but these modification are not stored permanently. Jul 21, 2015 at 14:12
After issuing the command in the interactive shell you can install
refindto fix EFI– EduardoAug 5, 2017 at 22:06
1Good to know that it is a bug. Simply
edit startup.nsh. +1 It is looking for
\EFI\boot\bootx64.efito skip the 5sec. Nov 26, 2017 at 11:44
1Copy and rename
\EFI\boot\bootx64.efiis the best. credit Nov 26, 2017 at 18:46
Update 3 did it for me....– cljkMar 26, 2018 at 8:18
I had the same problem (with the EFI enabled because I couldn't get it to run otherwise). Strange; although installation of Ubuntu 14.04.2 got no error, installing Kubuntu 15.04 failed to finalize. It froze at the very end when asked to remove DVD. After reset, it booted fine but after power down it brought up shell.
So, to avoid shell type:
and on the opened window add these 2 lines:
press Ctrl + s and Enter to save and Ctrl + q to quit. Then restart VM.
Alternatively, you can always use these 2 lines to exit shell and boot OS. But second time you restart you will be in a shell again and to avoid it edit
Typing the command does work but the problem is that on next restart it again goes to that shell and file startup.nsh does not seem to be saved. Aug 1, 2016 at 12:50
To save the startup.nsh file you need to use Ctrl+S to save and press Enter to write to file.– WilloczyOct 15, 2016 at 18:01
2In case you aren't using Ubuntu, you can figure out the correct path for your machine using
lsin the UEFI shell. E.g.
ls FS0:\EFI, then
ls FS0:\EFI\redhat, to learn the path is
FS0:\EFI\redhat\grub.efion CentOS.– ntc2Feb 13, 2018 at 0:31
1@ntc2 Thanks, that was exactly what I was looking for! For my Slackware installation it was
FS0:\EFI\Slackware\elilo.efi. Feb 20, 2018 at 9:52
Another option is to un-check the Extended Features option called 'Enable EFI' under 'Motherboard' for your VM.
Had this issue come up for Gnome Ubuntu 12.04.2 amd64bit installation.
Discovered this after having to change settings for hardware acceleration. I was left with having VT-x/AMD-V, Nested Paging enabled. My VM has 2 CPUs, 8GB RAM for reference.
After un-checking the issue is completely by-passed Gnome Ubuntu boots up no issues. Running Virtual Box 4.3.18 r96516 on Windows 7 64-bit Host.
1This only works because Grub also had legacy support (MBR). Aug 16, 2016 at 10:47
VirtualBox use that
bootx64.efi to boot.
Ref.: Archlinux Virtualbox wiki
ta. This works but if grubx64.efi is updated then bootx64.efi will be dated. link to a version of source code: github.com/mdaniel/virtualbox-org-svn-vbox-trunk/blob/… Jan 22, 2017 at 12:28
This one is more seamless than editing startup.nsh method, but indeed it won't be automatically updated and you can't use symlink either because it's a FAT32 partition. Nov 22, 2017 at 1:37
I recently encountered this problem. Please check your virtual OS settings. Right click on virtual os-> system->Extended features-> Enable EFI(uncheck this).
8How is this is a solution if one wants to use UEFI? Oct 20, 2016 at 20:41
+1: This solved my problem. I had experimentally checked Enable EFI and forgot about it.– wallykMar 4, 2019 at 14:41
if i disable that option after that it's not able to find bootable medium, even manually also it didn't worked Apr 5, 2020 at 17:33
I could solve this issue by changing the cdrom device within virtualbox from IDE to SATA. I removed the standard mapping of the virtual cdrom drive within the device configuration.
Simply add a cdrom device to the existing SATA Controller which is to be used for your installation media.
Et voila, no further problems with EFI.
for this you need to write it like the following:
fs0: cd EFI cd ubuntu grubx64
this is how i got it to work if you write it any other way it wont work.
Another work around:
In the uefi shell, boot temporarily in to ubuntu using:
fs0: cd EFI cd ubuntu grubx64
Then, inside ubuntu, edit startup.nsh file like below:
Open terminal Ctrl+Alt+T.
sudo nano /boot/efi/startup.nsh
Enter your password.
Now delete all that is in there using del or backspace key.
Then type this exactly: (
FS0- that is the numeral
0, not the alphabet
Now press Ctrl+O (That is alphabet O).
Then, Alt+D (To change text to msdos format).
Everything should be fine now.
Using Ubuntu 16.04.4 with EFI enabled and while starting the virtual machine I found that it won't boot and just stay in the EFI interactive shell.
This is how I fixed the boot:
First, I found that the grubx64.efi is located in BLK2, so for a one time boot I just typed the following in the interactive shell:
And viola, Ubuntu is up and running.
I order to permanently fix this issue, once the system was up I echoed the following line into /boot/efi/startup.nsh.
sudo echo 'BLK2:/EFI/ubuntu/grubx64.efi' > /boot/efi/startup.nsh
That's it, the system will boot correctly.
After installing Kubuntu15.10 in VirtualBox5 with UEFI, the reboot of the VM fails.
Adding the line
FS0:\EFI\ubuntu\grubx64.efiin the UEFI-Shell doesn't help.
And the solution with creating a new startup.nsh file in Kubuntu15.10 in the chroot environment with
sudo echo '\EFI\ubuntu\grubx64.efi' > startup.nshgives also no improvement.
I found the solution:
The problem was, that the directory /boot/efi/EFI/ubuntu with the file grubx64.efi doesn't exist.
After booting a Live-CD and changing to the chroot environment, I installed the missing packets and create the needed NVRAM entry with:
sudo apt-get install grub-efi-amd64-signed shim-signed sudo update-grub
For defining or change of efi boot directory need to first run this command. This solved my problem.
sudo grub-install /dev/sda --target=x86_64-efi --efi-directory=/boot/efi/
/dev/sda is the system hard disk.
On some linux guests , install process does not update the efi boot order. It depends on the distro version and virtualbox/efi version. This issue had affected, for example, Debian in early 2020 . The solutions are:
1.manualy run efibootmgr https://linux.die.net/man/8/efibootmgr
- fix efi boot order. For that, type first "exit" in efi shell, after vm start
For ArchLinux on Virtualbox, following did the trick for me. On EFI Shell enter the following
Shell> bcfg boot add 0 FS0:\EFI\GRUB\grubx64.efi "GRUB"
Here we are setting the EFI boot order. I assume this works for any other Linux guests as well having EFI boot. Note: Your directory structure might differ. You can do ls on EFI prompt to check your directory structure to reach grubx64.efi after entering FS0: and hit enter.
Hope this helps!
efibootmgror automatically by reinstalling grub) so it boots Ubuntu right away again.
efibootmgrare lost after shutdown (they stay on reboot though).