Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Ubuntu is stuck on an unusual screen

Writer Matthew Barrera

This is a bit strange, because when I try to start Ubuntu with VirtualBox from my MacBook Pro, this screen appears.

enter image description here

I installed Ubuntu with UEFI boot, because I wanted to enable virtualization (vt-x). It seems that this is not a good thing to do. Could anyone tell me how to quit this screen and come back to the original screen?

2 Answers

The problem was not with Ubuntu or its installation; it's a limitation of VirtualBox. To elaborate....

Under EFI/UEFI, a normal installation involves the OS installing its boot loader to the EFI System Partition (ESP), using an OS-specific name. (Ubuntu used EFI\ubuntu\shimx64.efi or EFI\ubuntu\grubx64.efi.) Because the boot loader name varies from one OS to another, the computer has to know what file to run. It knows this by recording the data in NVRAM. Ubuntu registers this information with the efibootmgr program. Both these details are handled by the Ubuntu installer; they're invisible to you during the normal installation process.

The problem is that VirtualBox can't seem to remember its NVRAM data -- at least, not when it's recorded by efibootmgr from a running Ubuntu installation. In my experience, VirtualBox remembers the data as long as the virtual machine is running, but it then forgets the information when you shut it down and restart it. The result is that the virtual machine boots back into the EFI shell, which is shown in the screen shot you shared. There are several solutions to this problem:

  • Use BIOS-mode booting -- You can switch VirtualBox to use a BIOS rather than an EFI. This is the solution you're using, based on your comments. It's a perfectly reasonable solution for booting Linux 99% of the time. If you need the EFI for some reason, though (say, if you're developing EFI applications), this won't be an acceptable solution. FWIW, EFI-mode booting is slightly faster than BIOS-mode booting under VirtualBox.
  • Use the EFI shell to launch GRUB -- You can learn the EFI shell commands to locate and launch a boot loader and use them to launch GRUB. Normally, the following commands should do the job:
    1. fs0: (but in some cases it may be fs1: or some other device)
    2. cd \EFI\ubuntu
    3. grubx64.efi
  • Use an EFI startup script to launch GRUB -- The EFI shell tries to run a shell script, called startup.nsh, when it launches. If you have this script launch grubx64.efi, it will launch when the EFI shell starts up. This will take a few seconds, though.
  • Register GRUB with the EFI setup utility -- Although VirtualBox doesn't remember its entries when they're created by efibootmgr, it does remember entries created with its own setup tool. Typing exit in the EFI shell should enter the setup tool. You can then use the Boot Maintenance Menu -> Boot Options -> Add Boot Option to locate GRUB and add an entry for it. Note, however, that the VirtualBox EFI's setup utility is finicky, so it's easy to overlook a critical step or otherwise do it incorrectly.
  • Rename GRUB -- EFI recognizes a special "fallback" filename (EFI\BOOT\bootx64.efi on x86-64 systems) that it launches if it can't find another bootable image. You can therefore rename GRUB to use this name. You can do this from the EFI shell:

    1. fs0: (again, this could sometimes be another device)
    2. cd EFI
    3. mv ubuntu BOOT
    4. mv BOOT\grubx64.efi BOOT\bootx64.efi

    Alternatively, you can do the same thing by using Ubuntu. You could use the installation medium in its "try before installing" mode or use the EFI shell to launch GRUB once and then use your regular installation. Either way, the ESP is normally /dev/sda1, so you'll need to mount that partition to make the changes. (If you use the regular installation, the ESP should be mounted at /boot/efi by default.)

Installing in BIOS mode from the start is likely to be the easiest solution; but if the virtual machine is already installed or if you need or want EFI-mode booting, renaming EFI/ubuntu/grubx64.efi to EFI/BOOT/bootx64.efi is usually the best solution.

That's not Ubuntu, it's UEFI Shell. That means, your Ubuntu installation is messed up and it isn't even booting.

12

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy