Booting from an ISO image using qemu

Qemu has two operating mode named full system emulation and user mode emulation. If you want to simulate whole system not just the cpu (like a PC) you need to use full system emulation mode.

Newer distributions have separate binaries for these two different operation modes. For example, if you just want user mode cpu emulation for X86-64 architecture, you need to use qemu-x86_64 binary and if you need whole X86-64 bit system emulation (like your PC), qemu-system-x86_64 binary must be used in commands below.

You have an iso image and you want to boot from it without restarting the system, simply use qemu virtual machine as below (-m 512 says qemu will be use 512 Mb of RAM from system):

qemu-system-x86_64 -boot d -cdrom image.iso -m 512

It is also possible to use your regular cdrom device too. If the device is /dev/cdrom you can boot a cd in the device like that:

qemu-system-x86_64 -boot d -cdrom /dev/cdrom -m 512

Above examples not use any harddisk, so it is suitable for live cd image case. If you want to install a distribution to a harddisk image file, you need to create harddisk image file first:

qemu-img create mydisk.img 10G

In this example we’re created an image of 10 GB. Now we can use this file as harddisk in our qemu boot:

qemu-system-x86_64 -boot d -cdrom image.iso -m 512 -hda mydisk.img

Hi, i have issue when create VM with qemu-system-x86_64?
When i create VM by qemu-system-x86_64 with
file iso(2Gb)
file*.vmdk,
enable-kvm,
ram 2048,
score 2,
then the install progress take long times (about 4hours)? i don’t know why it install VM very slow? I wan’t to check log install progress and solve issue that?

Please help me.
Thanks

If you give the -enable-kvm parameter but the emulation still so slow, probably Intel VT-x or AMD AMD-V CPU Virtualization Technology support is disabled by the BIOS.

Can you check Virtualization Support settings in BIOS? If your system doesn’t provide one of these technologies, everything will be emulated by the software.

I am running qemu-system-aarch64
I just have created the image and now trying to boot from ISO
But when I run the command nothing happens!

qemu-system-aarch64 -boot d \
                    -cdrom /root/Download/QEMU/CentOS-7-aarch64-Minimal-1810.iso \
                    -m 8000 -hda centos7-arm.img \
                    -machine virt -curses

Using an architecture other than X86 needs some extra work.

ISO cdrom images uses El-Torito standard (see: https://wiki.osdev.org/El-Torito)

In order to boot from an El-Torito based ISO image, your first stage bootloader (BIOS, EFI etc.) must understand the format. So, you need to prepare a qemu efi image too.

You can find detailed instructions here:

https://kennedy-han.github.io/2015/06/16/QEMU-debian-ARMv8.html

WARNING: Image format was not specified for 'windows_10_hard_disk.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

Is it OK to ignore this?

1 Like

that image must be formatted via diskpart you should pause on your installation of windows then go try access command prompt and setup your disk image via DISKPART… and make it active…after that must restart so the installation will detect your hard disk imag…

Hi,

Is it possible to run a non-linux .elf file in Qemu? (like a .elf file from the freeRTOS kernel)

Yes. You can emulate anything with qemu
from their website:
QEMU is a generic and open source machine emulator and virtualizer.

Full-system

emulation

Run operating systems for any machine, on any supported architecture

User-mode

emulation

Run programs for another Linux/BSD target, on any supported architecture

Virtualization

Run KVM and Xen virtual machines with near native performance

and from the rtos kernel website:

Hey there, i just installed windows xp virtual machine, using image.iso by following these instructions. But now i’d like to load this virtual machine for the next times when i start my computer. How can i do that ? Do i have to install the iso file every time i want to load a winXP virtual machine and startover ?