kvm install guest without gui?

Discussion in 'HOWTO-Related Questions' started by unclecameron, Mar 3, 2010.

  1. unclecameron

    unclecameron New Member

    I'm running Debian Squeeze and kvm/qemu which installed successfully. Is there any equivalent to the way xen did it, where it bootstraps in and you just console in and set the rest up, or do you have to build vnc somehow to finish the guest install? I don't want a gui on either host or guest.

    I have tried to start a new vm using:
    virt-install --connect qemu:///system -n vm11 -r 1024 --vcpus=8 -f /home/vm/vm11.qcow3 -s 100 -c /some/path/debian/debian-testing-amd64-CD-1.iso -vnc :1 --noautoconsole --os-type linux --os-variant debianSqueeze --accelerate --network=bridge:br0 --hvm
    which was successful, then try to connect to it with
    vncviewer :1 
    vncviewer my.lo.cal.ip:1
    but I get
    Error: can't open display
    I have also tried connecting to it with a Debian server running a gui on the same subnet using vnc, but it won't connect. Then I tried to use virt-install with the -serial switch, but that just errored out and wouldn't build the machine
    Last edited: Mar 3, 2010
  2. falko

    falko Super Moderator ISPConfig Developer

    Ubuntu has the vmbuilder tool which does it, but I don't know if it's available for Squeeze as well.
    Otherwise, you must use VNC, but you don't need to install a desktop on the host or guest. You jsut need some desktop system with a VNC client.
  3. unclecameron

    unclecameron New Member

    vmbuilder is available for Etch, but still waiting to be ported to Squeeze, it errors out when I attempt to run it.

    on a Debian machine with a gui and vnc on the same subnet trying to connect to ip.of.kvm.box:1 I get a connection refused, though I can vnc/rdp using this same client to several other boxes on the subnet, do I need to install any other app on the KVM box? The KVM box doesn't have a gui.

    If I can't get this to work, can I do the same thing in virtualbox, and is virtualbox performance similar to KVM? Most of the time I don't use gui's at all, that's a real disadvantage for server admin, which is why I used xen until it got pulled from the kernel in Squeeze :(
  4. falko

    falko Super Moderator ISPConfig Developer

    Is there a firewall on the host? What's the output of
    iptables -L

    Yes, you can do this with vBoxheadless (see the tutorials on this site), but you still need a remote desktop connection. I can't say much about the performance, but I guess KVM should be more performant since it's an official part of the kernel.
  5. unclecameron

    unclecameron New Member

    Since VirtualBox still needs a vnc server, I decided to just work on KVM again, in the meantime I got vncviewer to run a remote box after installing (on server)
    apt-get install tightvncserver xtightvncviewer
    vncserver :2 -geometry 1024x768 -depth 16 -pixelformat rgb565 
    now, after attempting to kill all kvm vm's from the original attempt (before trying VirtualBox) and then trying to install a new one with my :2 display selected, like this:
    virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
     -f /home/vm/sq1.qcow5 -s 50 \
     -c /path/to/debian-testing-amd64-CD-1.iso \
     -vnc :2 --noautoconsole --os-type linux --os-variant debianSqueeze \
     --accelerate --network=bridge:br0 --hvm
    I get
    ERROR    Guest name 'c' is already in use.
    Why do I get this, I'm not specifying guest 'c'? When I enter virsh and run
    virsh # list --all
     Id Name                 State
      - c                    shut off
      - vm10                 shut off
    virsh # destroy c
    error: Failed to destroy domain c
    error: Requested operation is not valid: domain is not running
    virsh # domstate c
    shut off
    virsh # dominfo c
    Id:             -
    Name:           c
    UUID:           b341252f-46f2-ff62-ef38-71ef2d441cf0
    OS Type:        hvm
    State:          shut off
    CPU(s):         8
    Max memory:     1048576 kB
    Used memory:    1048576 kB
    Autostart:      disable
    Security model: qemuDAC
    Security DOI:   
    how do I remove that guest and why can't I create a new one with the above virt-install command? I tried to start 'c' vm and then looked at it, here's what I have:
    ps aux | grep virt
    root      1932  0.0  0.0 245148  8452 ?        Sl   08:33   0:00 /usr/sbin/libvirtd -d
    106       2449  0.1  0.0 1732084 11884 ?       S    09:27   0:02 /usr/bin/qemu-system-x86_64 -S -M pc-0.11 -m 1024 -smp 8 -name c -uuid b341252f-46f2-ff62-ef38-71ef2d441cf0 -nographic -monitor unix:/var/lib/libvirt/qemu/c.monitor,server,nowait -boot c -drive file=/home/vm/vm11.qcow3,if=ide,bus=0,unit=0,format=raw -drive if=ide,media=cdrom,bus=1,unit=0 -net nic,macaddr=52:54:00:37:4f:e1,vlan=0,name=net0 -net tap,fd=46,vlan=0,name=hostnet0 -serial pty -parallel none -usb -usbdevice tablet -vga none -balloon virtio
    but it's not connected to a display so I can't view it on a remote machine, and even if I
    kill 2449
    I still get the same error when trying to create a new hostname. I think the install is hung, I just can't figure out how to unhang it :(
  6. unclecameron

    unclecameron New Member

    I have also tried to
    unregister c
    but it said there's no such domain, then I updated my switches to virt-install man page for squeeze, so it looks like:
    virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
    --file=/home/vm/sq1.qcow5 size=50 \
    --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ \
    -vnc :2 --noautoconsole --os-type=linux --os-variant=debiansqueeze \
    --accelerate --network=bridge:br0 --hvm
    but I get the same error:
    ERROR    Guest name 'c' is already in use.
    I have also tried using
    virt-install --prompt
    to do it interactively, but that script errors out with
    ERROR    this function is not supported by the hypervisor: virConnectNumOfDefinedStoragePools
    Traceback (most recent call last):
      File "/usr/bin/virt-install", line 972, in <module>
      File "/usr/bin/virt-install", line 762, in main
        options.sparse, options.nodisks, guest, conn)
      File "/usr/bin/virt-install", line 314, in get_disks
        get_disk(disk, size, sparse, guest, conn, is_file_path)
      File "/usr/bin/virt-install", line 280, in get_disk
        d = cli.disk_prompt(None, kwargs)
      File "/usr/lib/pymodules/python2.5/virtinst/cli.py", line 427, in disk_prompt
        dev = VirtualDisk(**arg_dict)
      File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 372, in __init__
      File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 863, in __validate_params
      File "/usr/lib/pymodules/python2.5/virtinst/VirtualDisk.py", line 733, in __check_if_path_managed
      File "/usr/lib/pymodules/python2.5/virtinst/util.py", line 553, in lookup_pool_by_path
        inactive_list = conn.listDefinedStoragePools()
      File "/usr/lib/python2.5/site-packages/libvirt.py", line 1583, in listDefinedStoragePools
        if ret is None: raise libvirtError ('virConnectListDefinedStoragePools() failed', conn=self)
    libvirtError: this function is not supported by the hypervisor: virConnectNumOfDefinedStoragePools
    after I specify filesystem type. Racking my brains out :(
  7. falko

    falko Super Moderator ISPConfig Developer

    Did you try
    undefine c
    in virsh?
  8. unclecameron

    unclecameron New Member

    virsh # undefine c
    error: failed to get domain 'c'
    error: Unknown failure
    virsh # list --all
     Id Name                 State
    virsh # quit
    #: virt-install --connect qemu:///system -n sq1 -r 1024 --vcpus=8 \
    > --file=/home/vm/sq1.qcow5 size=50 \
    > --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ \
    > -vnc :2 --noautoconsole --os-type=linux --os-variant=debiansqueeze \
    > --accelerate --network=bridge:br0 --hvm
    ERROR    Guest name 'c' is already in use.
  9. unclecameron

    unclecameron New Member

    I submitted a bug report to Debian Squeeze bugtracker, will post back here if I hear something, unless someone here has any suggestions left?
  10. unclecameron

    unclecameron New Member

    ok, even after you run virsh, you still have to connect to the local machine to undefine it:
    virsh -c qemu:///system undefine c
    but then something is wrong with my setup I'm using the create a new domain with virt-install, this tries to create another domain named 'c' for some reason, I'm betting it's due to a deprecated switch of some kind, possibly on the .iso source location, so I'm trying:
    virt-install --connect qemu:///system --name sq3 --ram 1024 --vcpus=8 -f /home/vm/vm14.qcow5 -s 100 --location=http://ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ --vnc :2 --network=bridge:br0 --hvm
    but that gives me the error:
    ERROR    operation failed: failed to retrieve chardev info in qemu with 'info chardev'
    I'll post if I get it working. In the meantime, just use Debian Lenny, it's far easier, I needed Squeeze because Lenny didn't have my NIC drivers for a HP DL180 G6 and I didn't want to compile them, they are part of Squeeze though.
  11. kevpatts

    kevpatts New Member

    Did you ever get this working? I'm having the same issue in Ubuntu Lucid when tring to start a KVM VM with /dev/mapper/nvidia_ebgdfiad1 as the hard disk.
  12. rnigam

    rnigam New Member

    Same Error on Ubuntu-Server-10.10

    Here is what I used:
    virt-install --connect qemu:///system -n ubuntu-vm1 -r 2048 --vcpus=4 -f /root/vmimages/kvm1.qcow2 -s 12 --cpuset=4,5,6,7 -c /root/vmimages/ubuntu-10.10-server-amd64.iso --os-type linux --network bridge=virbr0 --accelerate --virt-type kvm --hvm

    Here's what I get:
    Starting install...
    ERROR operation failed: failed to retrieve chardev info in qemu with 'info chardev'
    Domain installation does not appear to have been
    successful. If it was, you can restart your domain
    by running 'virsh start ubuntu-vm1'; otherwise, please
    restart your installation.
    ERROR operation failed: failed to retrieve chardev info in qemu with 'info chardev'
    Traceback (most recent call last):
    File "/usr/bin/virt-install", line 1033, in <module>
    File "/usr/bin/virt-install", line 915, in main
    start_time, guest.start_install)
    File "/usr/bin/virt-install", line 957, in do_install
    dom = install_func(conscb, progresscb, wait=(not wait))
    File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 973, in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
    File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1038, in _do_install
    File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1009, in _create_guest
    dom = self.conn.createLinux(start_xml, 0)
    File "/usr/lib/python2.6/dist-packages/libvirt.py", line 1277, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
    libvirtError: operation failed: failed to retrieve chardev info in qemu with 'info chardev'

    If someone has found a way around it please let me know.

    - Rohan
  13. caminero

    caminero New Member

    i'm using also squeeze/amd64, but have no virbr0 interface at all.

    On virsh i run net-start default, having:

    error: Failed to start network default
    error: internal error '/sbin/iptables --table filter --delete INPUT --in-interface virbr0 --protocol udp --destination-port 69 --jump ACCEPT' exited with non-zero status 1 and signal 0: iptables: Bad rule (does a matching rule exist in that chain?).

    net-edit default gives:
    <forward mode='nat'/>
    <bridge name='virbr0' stp='on' delay='0' />
    <ip address='' netmask=''>
    <range start='' end='' />

    any hints ?


  14. falko

    falko Super Moderator ISPConfig Developer

Share This Page