I wish to boot QEMU with a disk image I created from a real machine running Ubuntu. After creating the image and trying to run QEMU, the VM hangs on "Booting from Hard Disk".

Detailed Description

I have a desktop x86_64 machine on which I have installed standard Ubuntu 20.04.3. As per the default, this also installed GRUB as the bootloader on the 1TiB HDD. The disk has a GPT, a EFI partition, plus a single ext4 partition (~50GiB). This system boots, runs and is fully functional. Running from a live-USB, I have created a raw image of the entire boot disk. Lets call the image ae.img.

From a remote machine, I created the image by running

ssh root@<IP> "dd if=/dev/sda bs=100M status=progress | xz -T 8 -1" | unxz | cp --sparse=always /proc/self/fd/0 ae.img

Ignoring the xz/unxz which compressed the data over the network, essentially the entire disk was read by dd, sent over the network, and written to a sparse file ae.img by cp. For the running live USB, /dev/sda was the HDD. I have checked the partition table for the image using fdisk, and the data in the actual ext4 partition by mounting it as a loopback device.


I want to run a VM with this disk image on another (almost identical) system using QEMU. I think that if I specify this image as a drive on QEMU, it might try booting from it, then hit the GRUB bootloader, so on and so forth. To keep it identical, I am trying to boot it with a video output. The command I used was:

  -m 4G \
  -machine type=q35,accel=kvm \
  -smp 4 \
  -drive format=raw,file=ae.img \
  -cpu host \
  -display default \
  -vga virtio \

I have specified the image as a drive, given it a vga display, 4GB memory and 4 cores. Should be enough. Running this command gives me a QEMU window as displayed below. I am stuck on booting, with no further progress. htop reports that QEMU is consuming one core at 100%, with a bar 50% blue (low priority processes) and 50% red (kernel).

How do I diagnose what is going on? Any suggested fixes?

QEMU boot window

  • Just got some useful info. UEFI images require a different bios. Damn
    – TSG
    Commented Oct 5, 2021 at 15:40

1 Answer 1


Just figured it out.


QEMU boots with BIOS by default. This contrasts with the real system which booted with UEFI. UEFI and BIOS require different disk organizations. My disk image (from a UEFI system) hung on QEMU booting with BIOS.

Fix: append the option -bios /usr/share/ovmf/OVMF.fd

OVMF provides the correct firmware.

More detailed answer

Quoting from OSDev, "A legacy BIOS loads a 512 byte flat binary blob from the MBR of the boot device into memory at physical address 7C00 and jumps to it.". This probably contains some arbitrary data on an actual UEFI disk, causing it to hang.

  • Please don't forget to check back in 48 hours to accept your answer. From Review Commented Oct 5, 2021 at 19:29
  • 1
    note: on some distros this file is in /usr/share/ovmf/x64/OVMF.fd
    – nezu
    Commented Apr 15 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .