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?

share|improve this question
    
Good news everyone, with VirtualBox 5.1 the workarounds aren't needed anymore. You might just have to add a new EFI entry (manual using efibootmgr or automatically by reinstalling grub) so it boots Ubuntu right away again. – phk Jul 16 '16 at 14:17
1  
Even with 5.1, changes to efi variables, like the required boot setting with efibootmgr are lost after shutdown (they stay on reboot though). – chappjc Dec 21 '16 at 7:21
    
5.1.30 it still exist. Even though the fix is easy, but I have to fix every time after installing debian & ubuntu. – CallMeLaNN Nov 26 '17 at 11:41
up vote 45 down vote accepted

I encountered the same problem and found that if I issue following command in the interactive shell, the virtual machine would boot into Ubuntu:

fs0:\efi\ubuntu\grubx64.efi

(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.

Update 1:

I read this, tracked down to a bug report and found a better workaround.

Update 2:

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.

Update 3:

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"
share|improve this answer
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.efi sounds like the better solution to me than wasting 5 soconds wating for startup.nsh. Note: You can press F12 during boot or enter exit on 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. – LiveWireBT Jul 21 '15 at 14:12
    
After issuing the command in the interactive shell you can install refind to fix EFI – Eduardo Aug 5 '17 at 22:06
1  
Good to know that it is a bug. Simply edit startup.nsh. +1 It is looking for \EFI\boot\bootx64.efi to skip the 5sec. – CallMeLaNN Nov 26 '17 at 11:44
1  
Copy and rename \EFI\ubuntu\shimx64.efi to \EFI\boot\bootx64.efi is the best. credit – CallMeLaNN Nov 26 '17 at 18:46

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:

fs0:
edit startup.nsh

and on the opened window add these 2 lines:

FS0:
\EFI\ubuntu\grubx64.efi

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 startup.nsh.

share|improve this answer
    
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. – PSIXO Aug 1 '16 at 12:50
    
To save the startup.nsh file you need to use Ctrl+S to save and press Enter to write to file. – Willoczy Oct 15 '16 at 18:01

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.

share|improve this answer
1  
This only works because Grub also had legacy support (MBR). – Paul Stelian Aug 16 '16 at 10:47

Copy grubx64.efi to /EFI/boot/bootx64.EFI
VirtualBox use that bootx64.efi to boot.
Ref.: Archlinux Virtualbox wiki

share|improve this answer
    
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/… – philcolbourn Jan 22 '17 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. – Giorgi Gzirishvili Nov 22 '17 at 1:37

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.

share|improve this answer

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.

share|improve this answer

I recently encountered this problem. Please check your virtual OS settings. Right click on virtual os-> system->Extended features-> Enable EFI(uncheck this). enter image description here

share|improve this answer
    
This solved my problem. Thanks! – luongnv89 Feb 1 '16 at 9:58
7  
How is this is a solution if one wants to use UEFI? – zygimantus Oct 20 '16 at 20:41

After installing Kubuntu15.10 in VirtualBox5 with UEFI, the reboot of the VM fails.

Adding the line

FS0:\EFI\ubuntu\grubx64.efi
in 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.nsh 
gives 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
share|improve this answer

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.

Type:

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 O)

FS0:
\EFI\ubuntu\grubx64.efi

Now press Ctrl+O (That is alphabet O).

Then, Alt+D (To change text to msdos format).

Then press Enter.

Then Ctrl+X.

Now reboot.

sudo reboot

Everything should be fine now.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.