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,163
  • 7
  • 94
  • 131
subbu
  • 21
  • Try without option -nographic to get some output, and maybe -boot once=d,menu=on to get boot menu/boot from cd – ridgy Jan 16 '17 at 12:45

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,163
  • 7
  • 94
  • 131
  • I tried as you mentioned, still hanging. Is there any to see error logs, so that atleast I know where it is going wrong. – subbu Jan 16 '17 at 13:15
  • @subbu : Is virtualization technology enabled in the BIOS of the host machine ? If this is not the case, please boot into BIOS and enable it. I added how to check this and more information to the answer. :) – cl-netbox Jan 16 '17 at 15:47
  • I rechecked and it virtualization is enabled in hardware. My platform has harddisk size around 6GB and gave image size for VM as 4GB. And everything else is same as in the commands. But it still hangs, dont know where is the mistake. – subbu Jan 17 '17 at 07:15
  • @subbu : Sorry, I don't understand ... 6 GB disk space - 4 GB for VM ? In the question you used 10 GB ! :) – cl-netbox Jan 17 '17 at 07:24
  • I corrected the virtual harddisk size into 4GB. OS of my hardware is Linux localhost 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux – subbu Jan 17 '17 at 07:35
  • @subbu : There's something wrong with your OS, the latest version of Ubuntu 14.04 LTS is 14.04.5 -> http://releases.ubuntu.com/14.04.5 - Don't you update the system regularly ? I suggest that you install the newest Ubuntu LTS edition, which currently is at version 16.04.1 -> http://releases.ubuntu.com/16.04.1 ! :) – cl-netbox Jan 17 '17 at 07:45
  • @subbu when installing, make sure you *install not upgrade, as upgrades can cause instability –  Jan 17 '17 at 10:39
  • I upgraded the OS and it is still hanging but with one warning message. Could u pls help. – subbu Jan 17 '17 at 10:53
  • root@localhost:/home/lavelle# qemu-system-x86_64 -hda ubuntu-trusty.qcow -cdrom ubuntu-14.04.4-server-amd64.iso -m 512 -nographic warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5] Killed root@localhost:/home/lavelle# uname -a Linux localhost 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux root@localhost:/home/lavelle# qemu-system-x86_64 -hda ubuntu-trusty.qcow -cdrom ubuntu-14.04.4-server-amd64.iso -m 512 -nographic warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5] Killed – subbu Jan 17 '17 at 10:53
  • 1
    @subbu for pasting long text like that use a service like http://pastebin.ubuntu.com or gists. Here's a reformatted version: http://pastebin.ubuntu.com/23815864 –  Jan 17 '17 at 11:30
  • @subbu : Why did you add the -nographic option ? Please use the options provided in the answer ! Yesterday I have tested everything what you want to achieve with them (see screenshots) successfully. And another thing : Why are you running the commands as root ? Run them as normal standard user. :) – cl-netbox Jan 17 '17 at 11:48
  • I am using ubuntu server. the problem i am facing is how i can without X server. Could u please help – subbu Jan 18 '17 at 12:10
  • @subbu : How do you want to install something when you can't see anything ? A workaround would be to install the virtual system to the virtual disk from a system which has a GUI, afterwards you can run it from a server system. :) – cl-netbox Jan 18 '17 at 12:16