Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running Ubuntu Trusty using the current version of VirtualBox from Oracle's repo (with the extensions, if that matters).

When I create a Debian Wheezy guest using UEFI mode, the install works fine and the first boot is successful after the install. I then powered it off via the "poweroff" command, cloned the VM using the VirtualBox GUI.

After this point, the machines will not boot, neither the original or the clone. When I power them on, I get the VirtualBox EFI shell rather than GRUB.

The required EFI partitions are certainly present (the machine will boot at least once) so I know that's not an issue, which also rules out issues like "GRUB not being installed".

I would like these machines to be bootable, but I'm more curious as to why cloning a VM in UEFI mode prevents the original machine from booting. I could possibly see disk UUIDs changing affecting a clone, but I'm baffled as to why the original machine also won't boot.

share|improve this question

1 Answer 1

It's not the cloning that's causing the problems; it's powering off the virtual machine. Unfortunately, changes made by the Linux efibootmgr utility in the guest don't survive very long under VirtualBox. Because these changes are required to boot, the result is that once VirtualBox forgets them, you can't boot any longer. There are two broad classes of solution to this problem:

  • You can rename your boot manager or boot loader of choice to EFI/BOOT/bootx64.efi. This is done to files on the virtual machine's EFI System Partition (ESP), which is generally /dev/sda1. For a stock Ubuntu install, you'd rename EFI/ubuntu to EFI/BOOT and then rename grubx64.efi to bootx64.efi to make this work.
  • You can use some other tool to adjust the virtual NVRAM settings. The VirtualBox EFI user interface has a way to do this, but the steps are rather awkward. You could also use the bcfg command in an EFI shell. In either case, you must create an entry for the boot loader/manager of your choice, such as the EFI/ubuntu/grubx64.efi binary that the Ubuntu installer put on the hard disk.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.