Solved FreeBSD 13.0 boot stuck in "UEFI Interactive Shell" when EFI is enabled in VirtualBox

D

Deleted member 65953

Guest
In a fresh install of FreeBSD-13.0-RELEASE-amd64-disc1.iso in VirtualBox 6.1.32 (Ubuntu 20.04.4 host), I wanted to increase the console dimensions and console font size, so I followed the instructions here: How to increase vt console size in VirtualBox image.
(Note: that post uses the FreeBSD Virtual Machine image [FreeBSD-13.0-RELEASE-amd64.vhd]. Here, I am using the disc image [FreeBSD-13.0-RELEASE-amd64-disc1.iso] instead, because I wanted ZFS on root instead of UFS).

I adjusted the FreeBSD settings to "Enable EFI" (Settings > Motherboard > Extended Features > Enable EFI (special OSes only)":

virtualbox-settings.png


However, I am unable to boot into FreeBSD with EFI enabled. Every time I attempt to boot, I will be shown this "UEFI Interactive Shell". How do I fix the problem? Why did the FreeBSD Virtual Machine image [FreeBSD-13.0-RELEASE-amd64.vhd] manage to boot, while this installation from disc [FreeBSD-13.0-RELEASE-amd64-disc1.iso] gets stuck?

virtualbox-uefi-interactive-shell.png
 
What does the UEFI boot manager show?

Enter at the UEFI interactive shell exit, navigate to "Boot Manager", enter, post screenshot.

Afterwards boot into FreeBSD without EFI enabled, execute gpart show, post screenshot.
 
There is no ESP (EFI System Partition) installed, containing the loader.efi(8) to boot FreeBSD from. You have installed FreeBSD without EFI enabled in the VM's settings, the FreeBSD installer has seen only a BIOS and therefore didn't install a ESP.

The output of gpart show below displays how it looks like when the ESP is installed (note the "efi" partition type in the second line of the output):
Code:
=>      40  16777136  ada0  GPT  (8.0G)
        40    532480     1  efi  (260M)
    532520      1024     2  freebsd-boot  (512K)
    533544       984        - free -  (492K)
    534528    819200     3  freebsd-swap  (400M)
   1353728  15421440     4  freebsd-zfs  (7.4G)
  16775168      2008        - free -  (1.0M)

You have two options, first one is to install FreeBSD again with EFI enabled before installation, second option is to increase the VM size and add the ESP manually at the end of the disk.

If you decide for the second option and need assistance, please ask.
 
You have two options, first one is to install FreeBSD again with EFI enabled before installation, second option is to increase the VM size and add the ESP manually at the end of the disk.

Thank you for the information. I have just tried the first option. I enabled EFI before staring the install. Unfortunately, I could not even get to the installer. I got a "UEFI Interactive Shell" when I started the VM for the first time:

uefi-interactive-shell-2.png
 

When you're no longer stuck:
  • use efibootmgr(8) to set an order that suits your virtualised hardware.
Here, for example, after intentionally setting an unfriendly order (for demonstration purposes) …

… I booted in single user mode, then made what's secondary primary – by making 2 the first of the five comma-separated values:

1650160581269.png

In this case, the 0002 in Boot0002* UEFI VBOX HARDDISK VBb607675b-4f0e7f2b was coincidental, not indicative of order.
 

Hint​


Be aware of, but do not attempt manual edition of, the .nvram file.

If I recall correctly: a move of the guest by Oracle VM VirtualBox Manager (the application) will omit this file.

Code:
% ls -hln
total 17460
-rw-------  1 1002  1002   528K 17 Apr 03:25 FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.nvram
-rw-------  1 1002  1002   8.2K 17 Apr 03:25 FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.vbox
-rw-------  1 1002  1002   9.0K 17 Apr 03:25 FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.vbox-prev
-rw-r--r--  1 1002  1002    38G 16 Apr 18:46 FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.vdi
drwx------  2 1002  1002     6B 17 Apr 02:30 Logs
drwx------  2 1002  1002     5B 16 Apr 18:46 Snapshots
% file FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.nvram
FreeBSD-13.0-RELEASE-amd64-KDE-Plasma.nvram: Matlab v4 mat-file (little endian) \226v\213L\251\205'G\007[OP, numeric, rows 0, columns 0
%
 
Back
Top