Problems with (U)EFI simulation on Virtual Box

This is for discussing general topics about how to use VirtualBox.
Post Reply
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

Problems with (U)EFI simulation on Virtual Box

Post by _nobody_ »

Hello to everyone,

I have noticed the following problem while creating Debian Stretch using Virtual Box. I am using a Enable EFI (special oses only) option:
I have very similar setup (on Debian Stretch)
I have very similar setup (on Debian Stretch)
arch_arch-uefi-Settings_001.png (23.36 KiB) Viewed 2489 times
Now... It does not work for me as expected. :shock:

My issue is that I have not been able to get it to boot straight off the new /boot/efi/EFI/debian/grubx64.efi file that was created. The only way I can boot into Debian Stretch is to manually navigate to the grubx64.efi file. This does work, but it is annoying.

Then, I found very interesting net pointer, which explains how to solve this problem with host installations on the UEFI firmware: http://www.rodsbooks.com/efi-bootloader ... ation.html

I did apply the following from it:
Copying Boot Loader Files

Installing boot loader files to the ESP is a matter of using the Linux cp command (or its GUI drag-and-drop file manager equivalents) on the boot loader files. If you're installing a new boot loader, though, you may need to create a directory for it first. The total set of commands might resemble the following:

# cd original-directory
# mkdir /boot/efi/EFI/newloader
# cp -r * /boot/efi/EFI/newloader

These commands copy all the files from original-directory to a suitable directory (/boot/efi/EFI/newloader) on the ESP. Of course, original-directory must hold the original EFI boot loader files, and ideally nothing else—there's no point in wasting disk space on source code or other irrelevancies. Be sure that the files you copy include at least one file with a name that ends in .efi—this filename extension denotes an EFI binary file, such as a boot loader file. Some boot loaders require other files be copied, too, such as a configuration file or even your Linux kernel. I describe such requirements on the pages devoted to specific boot loaders.

In addition to the program's .efi file, you may need to copy a configuration file and other support files. If the source of the .efi file includes these extra files, copying the whole directory, as specified earlier, will copy them, too. You may need to copy them from elsewhere, rename them, or modify them, though. See program-specific documentation for details.

Note that some EFI boot loaders provide installation scripts. GRUB 2 comes with grub-install and rEFInd comes with refind-install, for instance. The details of what these scripts do vary from one program to another. Typically, they copy the necessary files and register the boot loader (as described in the next section).

In some cases, you may need to use a fallback filename, as described later, in Using a Fallback Filename.

Registering the Boot Loader with the EFI

The final step to installing a boot loader is to make the EFI recognize it. This step can be tricky because it varies from one system to another.

If you're booted using EFI mode, you can use the efibootmgr program to add your new boot loader to the EFI's boot menu. The command to do so looks like this:

# efibootmgr -c -d /dev/sda -p 1 -l \\EFI\\newloader\\loadername.efi -L NewLoader

This example adds /boot/efi/EFI/newloader/loadername.efi on /dev/sda1 to the EFI's internal menu of boot options. (You can often omit the -d /dev/sda and -p 1 options, which specify the disk device and partition number; they're only needed if the ESP is something other than /dev/sda1.) The resulting entry should appear under the name NewLoader. Note that the filename is specified relative to the ESP's root directory, using doubled-up backslashes (\\) rather than Linux's usual slashes (/) as separators. (Alternatively, you can enclose the filename specification in quotes and use single backslashes, \, rather than doubling them up. Some recent versions of efibootmgr also accept forward slashes [/] and translate them to the EFI's native backslashes.) Also note that at least one manufacturer (Lenovo) once shipped products with a known bug that causes the system to refuse to boot unless the boot loader's name (NewLoader in this example) is either Windows Boot Manager or Red Hat Enterprise Linux. I know of no recent (ca. 2014 or later) computers with this bug.
But this all did NOT help me at all?! :mrgreen:

Any provisos, addendums, opinions, another ideas... Anything that can help me???

Thank you,
_nobody_
_______
Last edited by socratis on 7. May 2018, 21:53, edited 1 time in total.
Reason: Fixed formatting.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Problems with (U)EFI simulation on Virtual Box

Post by socratis »

  1. I don't recall anyone (that knows a thing or two) mentioning that the EFI implementation is complete in VirtualBox. They even have the warning on the label, not even on the tooltip that they have for ICH9. So, don't expect things to work by the book, i.e. the specification.
  2. Search the webs for "startup.nsh site:forums.virtualbox.org". That should give you plenty of pointers... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

Re: Problems with (U)EFI simulation on Virtual Box

Post by _nobody_ »

Hello socratis, and yet anybody,

I forgot about this problem, since I got busy with the completely another IT domains/problems (to make some monies to put the food on the table and to pay the bills).

Before I start searching for: "startup.nsh site:forums.virtualbox.org" as suggested, does this problem had any straight answer/came close to the resolution in the meantime? God, Time flies, it already passed 9 months since I formulated and investigated it! :mrgreen:

Thank you,
_nobody_
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

Re: Problems with (U)EFI simulation on Virtual Box

Post by _nobody_ »

socratis wrote:
  1. Search the webs for "startup.nsh site:forums.virtualbox.org". That should give you plenty of pointers... ;)
Hello to everyone again,

Last four days I cleared some time to try to solve this problem. And, using pre-seed script with the Debian 10 Buster Live pre-release, I got stuck with the same problem.

Then, I finally (yesterday) found the solution to this problem:

Code: Select all

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.
Now, I need to create startup.nsh in directory /boot/efi with these two lines in it, in preseed/late_command stage.

If anybody knows this on the top of the head, U R more than welcome to post it in this thread (so I can save some time)! :idea:

_nobody_
Post Reply