Fixing "EFI stub: Exiting boot services and installing virtual address map..."

December 11, 2021

Update 2022-03-12 - If you’re seeing this after updating to the most recent linux kernel (>5.4.0-104) and you haven’t updated UTM, you should update UTM to at least version 3.1.5 which fixes boot issues.

UTM is a virtualization framework for Apple M1 ARM processors. However, compared to more establish virtualization frameworks like VMWare and Virtualbox, UTM still has bugs to iron out and features to implement.

One of the issues with UTM currently is that it has no support for ACPI shutdown, meaning you have to shut down from within the guest OS. This can also be problematic if the guest OS has crashed, locked up, or disconnected from network. When this happens, the only thing you can do is to forcibly turn off or restart the VM which can cause disk corruption.

When disk corruption happens, you might get a EFI stub: Exiting boot services and installing virtual address map... message on the next startup and the bootloader will hang. If your guest VM is based on Ubuntu, this can be solved by:

  1. Turning off the VM
  2. In the VM settings in the UTM management UI, under Display, switch the VM over to console-mode instead of full graphics.
  3. Restart the VM and wait for it to boot into load into a BareBox bootloader.
  4. Run fsck on the ubuntu disk partition (probably fsck /dev/mapper/ubuntu--vg-root if installed under default settings)
  5. exit Barebox. This should try to restart the VM and load into the Ubuntu VM. If the Ubuntu VM loads, then your disk issues are fixed.
  6. Turn off your VM again and switch back to full graphics in UTM.