11

When I try to boot a virtual machine using:

qemu-system-x86_64 -m 1024 -cdrom /host/iso/ubuntu-13.10-desktop-amd64.iso -name mac -hda ~/ubuntu

Iget a black screen just after the installation begins(before I choose the Language). I tried setting nomodeset in "Other options" but this did not resolve the issue.

However, using the same ISO, I can boot the VM using Virtual Machine Manager. I need to boot the VM using qemu-system-x86_64 for one of my projects.

Please let me know how to solve this.

jobin
  • 27,708
Sagar Patni
  • 491
  • 2
  • 4
  • 10
  • Not an answer to the question, but if you feel like fiddling with the resolution of the monitor, play around with the flag -vga [std|vmware|cirrus|qxl]. Refer man qemu-kvm for more details. – Nehal J Wani May 16 '14 at 20:56
  • Here I describe in great detail the best QEMU KVM setup that I've reached so far for Ubuntu: https://askubuntu.com/questions/884534/how-to-run-ubuntu-16-04-desktop-on-qemu/1046792#1046792 – Ciro Santilli OurBigBook.com Oct 04 '18 at 15:13
  • Came here because I was getting black screen in Win10 VM after changing VM memory to 2536MB. Changing it again to 2048MB solved for me. (I then settled with 3072MB). – Marc.2377 Feb 16 '19 at 18:01

1 Answers1

12

By default qemu-system-x86_64 does emulation, not virtualization. Emulation is slow and CPU intensive - you can see that by running top, which will show your CPU at close to 100%. I just booted Xubuntu 14.04 using qemu-system-x86_64 on my system, and it took 10 minutes to boot to the desktop. Ubuntu normally hides boot information, which is why you are seeing a black screen (or some other graphical artifacts caused by BIOS changing resolution). If you remove splash quiet and add debug to the kernel parameters you will see what it is doing during this time.

What you probably want to do is to run qemu-system-x86_64 -enable-kvm to enable support for hardware virtualization.

qemu-system-x86_64 -enable-kvm -m 1024 -cdrom /host/iso/ubuntu-13.10-desktop-amd64.iso -name mac -hda ~/ubuntu

From man qemu-system-x86_64:

-enable-kvm
       Enable KVM full virtualization support. This option is only available
       if KVM support is enabled when compiling.

(You might see people recommending the program kvm from the package qemu-kvm. kvm is just a wrapper script that does exec qemu-system-x86_64 -enable-kvm "$@")

KVM uses hardware virtualization rather than simulation, and hence is much faster. It requires a CPU that supports hardware virtualization extensions (VT-x for Intel, or AMD-V for AMD), which most modern PC systems have.

With virtualization, the CPU is actually executing the raw executable binary code from the guest OS. Virtualization is fast, but has the limitation that host OS and guest OS must be binary compatible. With emulation, the binary code of the guest OS is rewritten to run on the host CPU. It is slow, but has the advantage that you can run a guest OS compiled for a different CPU architecture (eg. A QEMU image for Debian armel explains how to run Debian ARM on a PC).

Another popular option for virtualization is VirtualBox.

bain
  • 11,260
  • kvm is only a wrapper over qemu-system-x86_64. By saying qemu-system-x86_64 is only emulation, do you mean to say kvm is a virtualization wrapper over the emulation provided by qemu-system-x86_64? – jobin May 13 '14 at 18:35
  • @Jobin thanks for pointing that out, answer adjusted accordingly. – bain May 13 '14 at 19:58