Problem with migrating running system into a VM

I have a running fedora 33 system that boots using EFI.
To test how to migrate (relocate) a system from hardware to VM I have done a clonezilla backup then did a restore of that image into my VM, but am having a boot problem.

When I try to boot from the installed image virtual HDD I get a black screen that hangs.

I can easily boot the from the live image and I verified the data was all restored properly but it just won’t boot from the disk.
I suspect the issue is the boot mode, since I am using QEMU/KVM vmm which I think only boots with MBR mode but the image was of an EFI booting machine.

So far I have tried (in a chrooted system)

  1. reinstalling the latest kernel
  2. running grub2-mkconfig twice, once with the output to /boot/efi/EFI/fedora/grub.cfg and once with the output to /boot/grub2/grub.cfg
  3. running dracut to recreate the initramfs file. I had to reinstall the 5.8.15 kernel used by the live image in order to use dracut.
  4. generated new UUIDs for each file system just in case the original which was copied from the original install interfered, then made the appropriate changes in /etc/fstab.

Nothing so far gets past the hang seen above.

I have no clue on how to switch the boot mode from EFI to MBR so I am stuck. A reinstall in MBR mode would negate a satisfactory migration from metal to VM.

Any suggestions?

I have also tried the same with VirtualBox but although I could get it to boot clonezilla I could not get VB to recognize the USB containing the image so I could not do the restore and that test was not successful either.

1 Like

A couple of things:

  • QEMU does support EFI. You just need to select the appropriate ovmf.
  • If you want to convert from EFI–>BIOS/Legacy, you need to do at least two things(there may be more):
    • You need to add the boot flag to the device you are trying to boot off of
    • You need to reinstall grub. Regenerating the config is not sufficient

If you are using virt-manager, here is how you change to EFI:

1 Like

I am using the virt-manager but I cannot seem to get to where i can alter the hypervisor. This is the only place I can even see info about the hypervisor.
Guide me to that screen you show please.

And I really do not want to switch to legacy, I want to be able to boot the system as it was when I made the image.

That is the place. However, I think you can only modify when you create the VM.

You can always recreate it and attach the existing disk.

1 Like

I am not sure the difference between yours and mine, but with F33 I seem to be totally unable to select between bios and efi in the VM. I have tried creating a new machine, booting from the live iso which has efi capability, but it still is locked into bios mode. The same with the clonezilla image which has efi support.

I also did a full uninstall of libvirt-* and virt-*, followed by a reboot, then reinstall of the same, with no changes in behavior.

Are you on F33 or F34?. There may be a difference there.

I am on F34 but I am fairly certain it worked the same way on F33.

The sequence is this

  • create a new VM
  • select one of the generic profiles, like “Generic Linux 2020”.
  • at the end click the box that says something like “Customize configuration before install”
  • make the changes before you pick, “Begin Installation”

That was the part I was not finding. The “customize configuration before install” check box.

Thank you very much. :blush:


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.