EFI boot configuration cannot be persistent

Discussions about using Linux guests in VirtualBox.
Post Reply
davidshen84
Posts: 12
Joined: 28. Dec 2009, 12:59
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: gentoo amd64

EFI boot configuration cannot be persistent

Post by davidshen84 »

Hi,

I installed my Lubuntu 64bit, and configured to use grub2-EFI mode. I setup the VM to boot in EFI mode, and everything works fine. As long as I don't shutdown the VM, the EFI boot correctly during reboot. But if I complete shutdown the VM, EFI boot configuration lost. I have to go to the BIOS EFI setup section to manually add a boot entry to boot my system.

I installed the system like normal, then I execute:

grub2-install --target=x86_64-efi --efi-directory /boot/efi

Then I try reboot, and it works fine. Maybe I missed something the VM settings?


Thanks,
David
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: EFI boot configuration cannot be persistent

Post by mpack »

Why would anyone look in "Windows Hosts" for this discussion? Never mind - rhetorical question. Moved to "Linux Guests".

Are you sure you're actually installing the guest onto the (virtual) hard disk? I rather suspect that you're actually just running in live CD mode. And, since that mode uses a volatile RAMdisk as the working drive, the contents are of course lost after a shutdown.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: EFI boot configuration cannot be persistent

Post by Perryg »

Not a VirtualBox issue.
You need to create a startup.nsh file (not done automatically)

Start the shell then follow the example below:

Code: Select all

Shell> fs0:
edit startup.nsh
\EFI\ubuntu\grubx64.efi
ctrl-s <cr>
<enter>
ctrl-q <cr>
reset

davidshen84
Posts: 12
Joined: 28. Dec 2009, 12:59
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: gentoo amd64

Re: EFI boot configuration cannot be persistent

Post by davidshen84 »

@Perryg, Thanks for the tip :)

My physical machine is also setup to use EFI, and I did not create such a script. Where can I find information/document about this kind of script?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: EFI boot configuration cannot be persistent

Post by Perryg »

You could type startup.nsh in google. That works for me.
I have posted the steps to create the script and even the the steps for a Debain based OS for the entries.
davidshen84
Posts: 12
Joined: 28. Dec 2009, 12:59
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: gentoo amd64

Re: EFI boot configuration cannot be persistent

Post by davidshen84 »

Perryg wrote:You could type startup.nsh in google. That works for me.
I have posted the steps to create the script and even the the steps for a Debain based OS for the entries.

Yes, I saw your script, and I found https://software.intel.com/en-us/articl ... -scripting very useful :) But why sometime I don't need this script, sometime I do? Most people fall into this EFI shell because they did not set EFI correctly. But, in my case, everything looks correct, and I may fall into this EFI shell only after I restart the vbox manager.
colinogreen
Posts: 2
Joined: 17. Oct 2015, 13:43

Re: EFI boot configuration cannot be persistent

Post by colinogreen »

Hello

I have turned on EFI in Virtualbox 4.x Unfortunately, although a CENTOS iso that I have appears to boot fine with UEFI turned on in VirtualBox the Ubuntu 14.04 'ubuntu-14.04.3-desktop-amd64+mac.iso' does not get past the shell.

I have followed the instructions in this but it doesn't seem to work. Whe I launch the edit startup.nsh command in the UEFI shell, all I get is the following message

Code: Select all

edit: Access Denied
Can anyone please help? Does the ubuntu-14.04.3-desktop-amd64+mac.iso not support UEFI properly?
colinogreen
Posts: 2
Joined: 17. Oct 2015, 13:43

Re: EFI boot configuration cannot be persistent

Post by colinogreen »

colinogreen wrote:Hello

I have turned on EFI in Virtualbox 4.x Unfortunately, although a CENTOS iso that I have appears to boot fine with UEFI turned on in VirtualBox the Ubuntu 14.04 'ubuntu-14.04.3-desktop-amd64+mac.iso' does not get past the shell.

I have followed the instructions in this but it doesn't seem to work. Whe I launch the edit startup.nsh command in the UEFI shell, all I get is the following message

Code: Select all

edit: Access Denied
Can anyone please help? Does the ubuntu-14.04.3-desktop-amd64+mac.iso not support UEFI properly?
Actually solved my own problem. I usually download the alternate version (ubuntu-14.04.3-desktop-amd64+mac.iso') but the one I wanted was the default ubuntu-14.04.3-desktop-amd64.iso without the 'mac' at the end.

That default download had the 'EFI' folder at the root of the .iso. OS installed ok from there and then I had to apply the fix in this thread afterwards on the writable EFI boot partition. Problem solved.
Winyl
Posts: 3
Joined: 18. Sep 2017, 20:23

Re: EFI boot configuration cannot be persistent

Post by Winyl »

Perryg wrote:Not a VirtualBox issue.
On contrary "My Dear Watson" it is a VirtualBox issue. It does not save contents of NVRAM to a file it can load on boot of VM. Although "PermanentSave" option of variables is present in NvRam.cpp code. But it is not used. Why?
Can someone enable saving of NVRAM contents to file? This issue still persists in 5.1.28 r117968 (Qt5.6.2). Nice.
kyb
Posts: 1
Joined: 22. Oct 2017, 20:36

Re: EFI boot configuration cannot be persistent

Post by kyb »

Code: Select all

edit: Access Denied
Unmount all CDs and DVDs. Than it will work.
I found an answer on a YouTube video: How to Start EFI Vbox host for Ubuntu/ Linux OS
Thanks to Fahid Shehzad
try the "ls" command and see the list of file, maybe on your computer your virtual CD ROM is being mounted as fs0.
if by doing the "ls" command you see files like Autorun.inf, autorun.sh etc, that means your CD Rom is mounted as fs0, in such case, try going to the other mounted options. Look for the GPT in the Mount-Description.
Last edited by socratis on 24. Oct 2017, 20:32, edited 1 time in total.
Reason: Added missing URL.
Post Reply