Why am I getting a black screen when booting VM using qemu?
Solution 1:
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.