2

I want to create a VM using KVM/QEMU by running the following sequence of commands. When I execute the qemu-system-x86_64 command, this command just hangs indefinitely. Could anyone please tell me where I am making a mistake?

wget http://ftp.tu-clausthal.de/pub/mirror/ubuntu/releases/14.04/ubuntu-14.04.4-server-amd64.iso
qemu-img create -f qcow2 ubuntu-trusty.qcow 10G
qemu-system-x86_64 -hda ubuntu-trusty.qcow -cdrom ~lavelle/ubuntu-14.04.4-server-amd64.iso -m 512 -nographic
cl-netbox
  • 31,491
subbu
  • 21
  • 1
  • 2

1 Answers1

2

You missed to tell qemu to boot from the installation media (-boot d) - so it tries to boot from the empty virtual disk and, you should select format qcow2 instead of qcow for the virtual disk.

First check whether virtualization is enabled and usable on your host operating system : kvm-ok
Output information needs to be -> INFO: /dev/kvm exists | KVM acceleration can be used

Download the Ubuntu installation file to the folder where you want to store it :

wget -O /path-to-the-storage-location/ubuntu-14.04.5-server-amd64.iso http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso  

Create the virtual disk in the folder where you want to place and store the disk :

qemu-img create -f qcow2 /path-to-the-virtual-disk/ubuntu-trusty.qcow2 10G  

Boot from the Ubuntu installation media to install it to the attached virtual disk :

qemu-system-x86_64 -hda /path-to-the-virtual-disk/ubuntu-trusty.qcow2 -cdrom /path-to-the-installation-media/ubuntu-14.04.5-server-amd64.iso -boot d -enable-kvm -m 512  

When you execute the command, the terminal looks like that (Do you eventually mean this with qemu-system-x86_64 hangs ? Don't add an option which prevents a new window to be visible) :

qemu-1

A new 'QEMU terminal window' opens, showing the expected option to install Ubuntu from the installation media (Note : this is an example from my setup - so the boot options are different) :

qemu-2

Additional information : In case the installer doesn't recognize the disk, follow these instructions.

cl-netbox
  • 31,491