1

I want to setup a VM (host:ubuntu server / guest ubuntu server)

I connect through putty (from windows) to my server and launch the following commands:

#create the guest image
qemu-img create -f qcow2 test.img 6G
#launch the guest
kvm -m 256 -cdrom ubuntu-14.04.1-server-amd64.iso -boot d test.img

and I get the following error:

Could not initialize SDL(No available video device) - exiting

I guess that it makes sense since the server is not connected to any screen... But, I need some way to go around it.

After looking on some forums, I have tried to add the option -curses. Unfortunately the putty screen displays 640x480, and then I cannot do anything.

Does anyone has any idea?

2
  • try to use mobaxterm from winzoz
    – c4f4t0r
    Aug 7, 2014 at 16:08
  • 1
    Using kvm directly is a good way to cause yourself a lot of pain. Use libvirt and its associated tools (e.g. virsh, virt-install, etc.). Aug 7, 2014 at 16:29

1 Answer 1

2

As Michael Hampton suggested, instead of using KVM directly use virsh, which simplifies handling virtual machines (not only KVM) a lot.

As root, first install the needed packages:

apt-get install virtinst libvirt-bin

You might want to have network-access on your guest machine you will need to have to create a bridge interface on your Host-system (let's say br0) or have a dedicated network interface assigned to your guest (mostly the first solution is preferred).

To create your guest, you will use the command virt-install. As root, run

virt-install --name=guest_name --virt-type qemu --vcpus 1 --ram=256 --os-type=linux --os-variant=ubuntutrusty --connect qemu:///system --network bridge=br0 --cdrom /path/to/ubuntu-14.04.1-server-amd64.iso --disk path=/path/to/test.img,size=6 --noautoconsole

Note that if you define the --disk parameter with the size (it's in GB btw.) option, the image will be created automatically during the installation. If you already created that image you can leave that option out to use your existing image. If you create a new image you might also want to add the option "format", eg.

--disk path=/path/to/test.img,size=6,format=qcow2

Instead of an image file you can also use an LVM-device or a dedicated partition/hard drive.

--noautoconsole prevents you from directly connecting to the guest after creation. If you want to automatically connect, leave this option out.

Use

virsh console guest_name

to connect to your guest (this works from putty as well). To get out of the console, press CTRL + 5 or CTRL + ] (english keyboard layout only, if you use another layout, search on Google, on German layout it's CTRL + 9)..

Options that can be considered:

--hvm Forced the guest to be fully virtualized. If you leave this out, virt-install will by default try to create a paravirtualized guest.

--graphics vnc or --graphics sdl or --graphics none By default, virt-install will set --graphics=vnc if the DISPLAY environment variable is set, so in most cases you can leave that option out. If you want to use sdl (most people I know use VNC), you take the other option. If you don't want to have graphic output you will NEED to specify a serial output for the text console to be able to access it via "virsh console guest_name".

--arch=ppc64 By default, the architecture of the host will be passed to the VM. However if you want to have something different, set this option (with the desired architecture of course)

1
  • 1
    Also remember virsh vncdisplay Aug 7, 2014 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .