Ubuntu 14.04 Generation 2 VM Template Boot Issue Workaround

Recently Ubuntu 14.04 has native support for booting under a Hyper-V Generation 2 VM. Unfortunately, the VM will not boot if the VHD has been copied over to a new VM. This is a known issue and it has been reported on Ubuntu’s Launchpad bug reporting system by a Project Manager inside Microsoft who is responsible for making Linux run under Hyper-V.

The reason why it doesn’t work is during installation of the guest, Ubuntu uses a non standard path for the bootloader shim called shimx64.efi. On most AMD64-based UEFI systems if there is no boot entry specified in the firmware, it defaults to looking for bootx64.efi residing in the /EFI/BOOT directory of the EFI partition. Since Ubuntu doesn’t do that, it can pose problems if anybody wants to create a template out of it and deploy it for new virtual machines.

The current workaround I’ve came up is to rename the /EFI/ubuntu directory to /EFI/BOOT and inside the /EFI/ubuntu directory, rename shimx64.efi to bootx64.efi.

For guidance on making pretty much any Linux based distributions boot under a Generation 2 Hyper-V VM, there’s always this post.


Since I’ve received an e-mail from the OSTC division inside Microsoft saying my workaround didn’t work, I’ll clarify my workaround a bit:

  • Rename the /boot/efi/EFI/ubuntu directory to /boot/efi/EFI/BOOT
  • In the newly renamed BOOT directory, rename shimx64.efi to bootx64.efi

Optionally you can choose not to rename shimx64.efi to bootx64.efi, but rather rename grubx64.efi to bootx64.efi since Secure Boot isn’t being used entirely.

Leave a Reply

Your email address will not be published. Required fields are marked *