Lỗi trên windows server 2023 virtualbox efi shell startup.nsh

The EFI shell is a command-line tool similar in concept to bash in Linux/Unix/OS X or a Command Prompt window in Windows. It lets you view, delete, edit, and rename files, to update EFI boot manager entries, and so on. You can exit from the shell by typing exit; however, in the case of VirtualBox, this will probably bring you to an EFI menu that can be just as confusing.

If you've installed an OS in your VirtualBox session, chances are it installed a boot loader on the EFI System Partition [ESP]. Most OSes register these boot loaders with the firmware, which remembers them and boots them automatically. One quirk of VirtualBox is that it usually forgets these boot manager entries. The result is that the VM boots up into the EFI shell by default. There are several ways to deal with this problem, including:

  • You can launch the boot loader manually by using the EFI shell:
    1. Type fs0: to access the first filesystem, which is usually the ESP.
    2. Type cd EFI{osname}, where {osname} is the name of the directory where your OS installed its boot loader. [You haven't said what OS you've installed, so I can't be sure what that is. Typing ls EFI will show you what's there.]
    3. Launch the boot loader by typing its name. Again, I can't know what that is. For Linux, it's usually grubx64.efi. For Windows, it's bootmgfw.efi.
  • Automate the above procedure with an EFI shell startup script [startup.nsh in the root directory of the ESP].
  • Rename the boot loader to EFI\BOOT\bootx64.efi, which is the fallback filename:
    1. Type fs0: to access the first filesystem, which is usually the ESP.
    2. Type fs0:`0 to rename the directory in which the boot loader resides. As above, you'll have to determine what {osname}` is yourself.
    3. Type fs0:`2, where `fs0:`3 is the boot loader's name, such as `grubx64.efi for most Linux installations.
  • Register the boot loader with the VirtualBox firmware by using the shell's tools. I don't know of a concise description of how to do this on the web, offhand, and I don't have time to write it up here. It's likely to be frustrating without precise instructions because there are a lot of non-obvious pitfalls you must avoid.

Personally, the solution I most often use is to rename the boot loader from the OS's default to EFI\BOOT\bootx64.efi. This is the easiest to implement and it works well enough. One drawback to this approach is that if your OS ever updates the boot loader, the update will probably go to the original location, so you'll have to repeat the process if you want to use the updated boot loader.

When I try to add a new machine and Start VirtualBox, instead of the ISO booting I get the attached screen the first line of which reads UEFI Interactive Shell v2.2. I have tried several different iso files with the same result. I suspect a very simple change to Settings or something else will cure it - advice would be much welcomed.

Attachments VirtualBox.jpg [102.03 KiB] Viewed 24557 times

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

by mpack » 22. Dec 2021, 17:40

Please provide a VM log file. Make sure the VM is fully shut down, then right click it in the manager UI. Select "Show Log" and save "VBox.log" [no other file] to a zip file. Attach the zip here.

Also, FYI the Windows Snipping Tool makes far better screenshots than a jpeg photo from your handheld phone.

I don't understand how EFI works. All it does is boot into a useless shell. I've tried the Windows 8 DVD ISO as well as Fedora 16. Am I missing something? Is there some command I have to type in? Why doesn't EFI just boot from the DVD drive like a real BIOS?

BillG Volunteer Posts: 5075 Joined: 19. Sep 2009, 04:44 Primary OS: MS Windows 10 VBox Version: PUEL Guest OSses: Windows 10,7 and earlier Location: Sydney, Australia

wearywanderer Posts: 3 Joined: 11. Apr 2011, 11:13 Primary OS: MS Windows 7 VBox Version: PUEL Guest OSses: Windows Server 2008 R2 x64

by wearywanderer » 18. Jul 2012, 18:54

I'm trying to create a EFI guest running Windows Server 2008 R2 SP1 on a Windows 7 Ent SP1 host with VirtualBox 4.1.18

Screenshot of the settings of the VM showing EFI enabled:

1.JPG [48.03 KiB] Viewed 236004 times

Screenshot of the settings of the VM showing VT-x enabled:

2.JPG [31.91 KiB] Viewed 236004 times

Screenshot of the settings of the VM showing the image loaded onto the CD/DVD Drive:

3.JPG [49.03 KiB] Viewed 236004 times

contd...

wearywanderer Posts: 3 Joined: 11. Apr 2011, 11:13 Primary OS: MS Windows 7 VBox Version: PUEL Guest OSses: Windows Server 2008 R2 x64

by wearywanderer » 18. Jul 2012, 18:59

When I start the VM it asks me to "Press any key to boot from CD or DVD..."

4.JPG [21.56 KiB] Viewed 236004 times

No matter how hard or how often I'm hitting it boots to the EFI Shell Based on the Microsoft Technet article, Installing Windows to an EFI-Based Computer [//technet.microsoft.com/en-us/libr ... 1[v=ws.10]] I "select the device with the Windows installation media, and then start the EFI boot application":

5.JPG [83.97 KiB] Viewed 236004 times

But it does nothing:

6.JPG [18.82 KiB] Viewed 236004 times

What am I doing wrong?

BillG Volunteer Posts: 5075 Joined: 19. Sep 2009, 04:44 Primary OS: MS Windows 10 VBox Version: PUEL Guest OSses: Windows 10,7 and earlier Location: Sydney, Australia

by BillG » 19. Jul 2012, 07:08

I have never tried it, but this is what the manual says.

Note that the VirtualBox EFI support is experimental and will be enhanced as EFI matures and becomes more widespread. While Mac OS X and Linux guests are known to work fine, Windows guests are currently unable to boot with the VirtualBox EFI implementation.

Bill

Kennyngston Posts: 2 Joined: 26. May 2013, 19:22

by Kennyngston » 26. May 2013, 19:44

Hi,

I am facing the same issue.

I'm trying to boot a Win8 [64 bit] ISO [bootable ISO9660] on VM 4.2.12 with EFI, and I get the shell as well. Is there any progress with this issue?

I get this error, while the virtual machine is booting:

I get this error while VM boots win8isoerror.png [22.49 KiB] Viewed 235321 times

This is the shell, while the ISO is added as storage to the VM. [BLK1:\ ls produces the same output as fs0:\ ls, just didn't fit in the screen shot]

efi shell win8isoefishell.png [33.69 KiB] Viewed 235321 times

The boot file is in fact on the ISO:

bootx64.efi win8isoefibootfile.png [18.64 KiB] Viewed 235321 times

In the motherboard config I have EFI enabled with 1GB RAM [tried with 4 as well], on the processor tab I have PAE/NX enabled, on the acceleration tab I have enabled the VT-x/AMD-V and Nested Paging [if needed I can attach screenshots as well].

Side note: the ISO boots when I'm not using EFI on the VM.

Is there anything I'm doing wrong?

tom12454 Posts: 4 Joined: 21. May 2015, 09:19 Primary OS: Ubuntu other VBox Version: OSE self-compiled Guest OSses: Linux, FreeBSD

by tom12454 » 21. May 2015, 09:32

This is how I got Kubuntu 15.04, 64 bit running an a VM with EFI enabled:

Settings: * System -> Motherboard -> Extended Features: Enable EFI * Boot HDD must be attached to SATA controller! IDE, SCSI or SAS will not work [bug report: Ticket

14142]

EFI Boot Screen:

When the UEFI boot screen appears, it should show blkX: and fsX: devices. fsX: are file systems accessible by the boot loader. If the EFI boot partition does not appear as fsX:, the boot manager will not be able to boot. This will happen if the EFI partition is on a disk attached to an IDE, SCSI or SAS controller [see above].

Boot from the EFI boot shell [for Ubuntu system, others may be different]:

efi\ubuntu\grubx64.efi

Once you know what to boot [in my case: efi\ubuntu\grubx64.efi], put this line into a new file startup.nsh in the root directory of the EFI file system. Then, the EFI boot loader will boot it automatically after 5s.

Lei12 Posts: 2 Joined: 26. Apr 2016, 12:42

by Lei12 » 2. May 2016, 21:28

With Boot HDD effectively attached to SATA controller, after trying Debian 8.4.0 [64bit], Ubuntu 16.04 LTS [64bit] and a Ubuntu 32bit version, I could only get the VM installed with a Kubuntu 16.04 LTS [64bit], with no need to deal with any of the previous UEFI menu.

All 3 first attempts did not succeed since startup.nsh file access permission was denied.

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

by socratis » 3. May 2016, 17:40

Just out of curiosity... Why do you have to boot from EFI? Isn't BIOS good enough? Especially when VBox says it's not supported?

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.

Rootman Posts: 251 Joined: 1. Oct 2012, 18:29

by Rootman » 3. May 2016, 17:55

socratis wrote:Just out of curiosity... Why do you have to boot from EFI? Isn't BIOS good enough? Especially when VBox says it's not supported?

Just to test it, there were previous messages just like the OP's - "How do I boot EFI" or "Does EFI work?" I did it to prove it works, and it does. I seldom use the VM as Windows 10 still has a lot of performance issues under Virtualbox.

I did a Win 7 updated Win 10 that boots MBR and a previous 32 bit Win 10 that's MBR. Just wanted to prove it works.

Chủ Đề