I recently migrated a virtual machine from VMware to HPE VM Essentials (VME) and discovered that the migration process created the new VME VM as UEFI based when it was actually supposed to be BIOS based, and a result, the OS would not boot under VME. Unfortunately, at the time of this writing, VME Manager (8.0.9) does not provide any means to accomplish this via the WebUI in Manager. This meant I needed to edit the VM definition and change it. While it is possible to accomplish, this is very unsupported by the VME team as you need to manually edit the .xml definition file (which they do not support). That said, I’m guessing if you are hear reading this, you don’t care and just want your VM to boot… So lets get to it!
Please note: Use any tips, tricks, or scripts I post at your own risk.
From the HVM host console that hosts the VM, ensure the VM is shut off and then run:
virsh edit VMNAME
(Note – VMNAME is case-sensitive throughout these instructions)
Approximately 24 lines down, you will see the following two sections for <os> and <features> (if the VM is UEFI based):
<os>
<type arch='x86_64' machine='pc-q35-8.2'>hvm</type>
<loader readonly='yes' secure='yes' type='pflash'>/var/morpheus/kvm/OVMF_MVM.fd</loader>
<nvram template='/var/morpheus/kvm/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/VMNAME_VARS.fd</nvram>
<bootmenu enable='no'/>
<smbios mode='sysinfo'/>
</os>
<features>
<acpi/>
<apic eoi='on'/>
<hyperv mode='custom'>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vpindex state='on'/>
<synic state='on'/>
<stimer state='on'/>
</hyperv>
<smm state='on'/>
</features>
(Note – I apologize because the xml formatting above is not correct – I’ve struggled the last hour with WordPress.com’s stupid editor to fix this and I give up – it’s a piece of shit, and they want to charge me a bunch more money to get a plugin to fix this, which I refuse to do).
To convert this VM to BIOS based, delete the following two lines from <os>:
<loader readonly=’yes’ secure=’yes’ type=’pflash’>/var/morpheus/kvm/OVMF_MVM.fd</loader>
<nvram template=’/var/morpheus/kvm/OVMF_VARS.fd’>/var/lib/libvirt/qemu/nvram/VMNAME_VARS.fd</nvram>
Also delete the following line from <features>:
<smm state=’on’/>
To delete lines in virsh edit, you can just put your cursor on the line to delete and press the letter d twice quickly. To save the configuration in virsh, press Esc, : (colon), and enter wq! and hit enter. Assuming you did not mess the editing up, the file will save. If you see “Failed. Try again? [y,n,i,f,?]”, then press N to completely discard the changes you made and start again. Pressing Y will take you back to the configuration with your changes still present, but unless you know exactly what you did wrong, I do not recommend doing this.
Remove the now unrquired NVRAM file: rm /var/lib/libvirt/qemu/nvram/VMNAME_VARS.fd
Now you should be able to start your VM (virsh start VMNAME)
If need to convert from BIOS to UEFI, use the same method, except in virsh edit, press the letter i (eye) to enter insert mode and update the <os> and <features> sections to mirror above. Take note that you need to update the NVRAM file name, and then back in the console will you need to:
cp /var/morpheus/kvm/OVMF_VARS.fd /var/lib/libvirt/qemu/nvram/VMNAME_VARS.fd
Then you should be able to start your VM.
dcc